prismRegion:TabControlRegionAdapter.ItemContainerStyle style as a resource?

Topics: Prism v4 - Silverlight 4
Aug 9, 2012 at 8:17 AM

Can I set prismRegion:TabControlRegionAdapter.ItemContainerStyle as a resource, rather than inline.

This works:

      <prismRegion:TabControlRegionAdapter.ItemContainerStyle>
        <Style TargetType="sdk:TabItem">
          <Setter Property="HeaderTemplate">
            <Setter.Value>
              <DataTemplate>
                <TextBlock Text="{Binding HeaderInfo}" />
              </DataTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </prismRegion:TabControlRegionAdapter.ItemContainerStyle>

but I'm having to use it all over the place, violating the DRY principle.  But I can't work out how to make it a resource.  Is it possible?

I'm using Silverlight 5.

Developer
Aug 9, 2012 at 4:54 PM

Hi,

Based on my understanding you should be able to define your Style as a resource and set it to your TabControlRegionAdapter.ItemContainerStyle property for example like this:

 

<sdk:TabControl Name="MainRegion" Regions:RegionManager.RegionName="MainRegion" Regions:TabControlRegionAdapter.ItemContainerStyle="{StaticResource HeaderStyle}">

Also, I believe ,you could check the Stock Trader Reference Implementation, which uses a similar approach in the AnimatedTabControl defined as a region in its Shell view.

I hope you find this handy,

Agustin Adami
http://blogs.southworks.net/aadami

Aug 12, 2012 at 6:02 AM

Thanks, that sorted it out for me.  It's now working.