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?
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"/>
<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.
Thank you! I think this is just what I was looking for. I will let you know how it goes.
-Jeff
Hi Jeff,
Glad to help. Please let me know if you have any questions.