Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Icons on XamTabs?
posted

I want to be able to allow a user to set a module as a Favorite by toggling a star icon that is placed on each XamTab. Is this possible using Infragistics XamTabs?

Parents
  • 12875
    Suggested Answer
    posted

    Hi,

     

    The technique you want to use is to template the tab header.  In my sample you’ll see that I targeted the TabItemEx and provided a HeaderTemplate and also pointed to a ContentTemplate which you will probably want to customize and bind to other properties.

     

    <DataTemplate x:Key="MyHdr">

        <StackPanel Orientation="Horizontal" Background="White">

           <TextBlock Text="{Binding Name}" Margin="5,0,15,0"/>

           <RadioButton IsChecked="{Binding IsFavorite, Mode=TwoWay}"

    GroupName="RB" IsThreeState="False" />

           <Image Source="star.png"

    Visibility="{Binding IsFavorite, Converter={StaticResource VC}}"

                    MaxHeight="20" MaxWidth="20" Margin="2,2,2,2" />

       </StackPanel>

    </DataTemplate>

     

    <DataTemplate x:Key="MyContent">

        <StackPanel Orientation="Horizontal" Background="Lavender"/>  

    </DataTemplate>

     

    <Style TargetType="{x:Type igWindows:TabItemEx}" >

        <Setter Property="HeaderTemplate" Value="{StaticResource MyHdr}"/>

        <Setter Property="ContentTemplate" Value="{StaticResource MyContent}"/>

    </Style>

     

    You see that I added a Radio Button and an Image to the header which are bound to the IsFavorite property in my viewmodel causing the image to be visible when the radio button is checked.  The VisConverter is being used to toggle the visibility property of the image.

     

    Please let me know if you have any questions.

    TabBinding.zip
Reply Children
No Data