Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
On my TabControl I have a Content Template that implements a Transition template. What I would like to do is have one template be used when the tab selected is 'higher' (to the right) and a different one when the tab is lower (to the left) of the current selected tab. This is to make it look more like flipping pages in a book. You flip one way to go forward and another to go back.

I have the translations ready I just need to figure out how switch between them correctly. Below is a possible starting point. What would be extremely wonderful would be if this could
used in the Resource Dictionary and not tied to a specific TabControl. I don't know if a trigger is the right way to go.

<TabControl.ItemContainerStyle>
            <Style TargetType="TabItem">
                <!--set the content template in setter first-->
                <Setter Property="ContentTemplate" Value="{StaticResource TabTemplateRotateLeft}" />
                <Style.Triggers>
                    <!--use data trigger to switch the content template-->
                    <DataTrigger Binding="{Binding}" Value="All" >
                        <Setter Property="ContentTemplate" Value="{StaticResource TabTemplateRotateRight}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </TabControl.ItemContainerStyle>



Any help would be appreciated. I'm still pretty new to WPF and I know many things are possible but not how to do them.
Posted

1 solution

It might be easier to use a ValueConverter. At least it is easier to bebug. For information on using IValueConverter, try this article: Data-Binding-Using-IValueConverter-in-SilverlightData Binding Using IValueConverter in Silverlight[^]
 
Share this answer
 
v2
Comments
bowlturner 21-Aug-13 17:03pm    
I've yet to use a ValuleConverter. How would you suggest I go about it? I think that is sending me on the right track.
Clifford Nelson 22-Aug-13 14:29pm    
Have updated the solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900