This is a migrated thread and some comments may be shown as answers.

Selected tab image change

2 Answers 84 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Virag
Top achievements
Rank 1
Virag asked on 02 Nov 2012, 03:19 PM
I have set the Image in tab header In RadTab . Not I want to change the Image of selected tab.
I need your help to sort out this issue.

Following is my code

<telerik:RadTabControl x:Name="ProductEditTabControl" Grid.Row="0" Style="{StaticResource StyleRadTabControl}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" SelectionChanged="ProductEditTab_SelectionChanged" >
                    <!-- GENERAL -->
                    <telerik:RadTabItem Name="GeneralTab" Style="{StaticResource TabItemStyle}">
                        <telerik:RadTabItem.HeaderTemplate >
                            <DataTemplate>
                                <StackPanel>
                                    <StackPanel Name="GeneralStk">
                                        <Image Name="GeneralLogo" Height="75" Width="80" Source="/CROSS.Administration;component/Assets/general_normal_gray.png" VerticalAlignment="Center" Cursor="Hand" />
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </telerik:RadTabItem.HeaderTemplate>
 
                        <productViews:ProductEditGeneralCtrl />
                    </telerik:RadTabItem>
 
                    <!-- MATERIALS -->
                    <telerik:RadTabItem x:Name="MaterialsTab" Style="{StaticResource TabItemStyle}">
                        <telerik:RadTabItem.HeaderTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <StackPanel>
                                        <Image x:Name="MaterialsLogo" Height="75" Width="80" Source="/CROSS.Administration;component/Assets/materials_normal_gray.png" VerticalAlignment="Center" Cursor="Hand" />
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </telerik:RadTabItem.HeaderTemplate>
 
                        <productViews:ProductEditMaterialCtrl />
                    </telerik:RadTabItem>
  </telerik:RadTabControl>


Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel R. Pavlov
Telerik team
answered on 06 Nov 2012, 09:55 AM
Hello Virag,

I am not sure if you are using a data-binding approach in your code snippet. I see static defined (XAML defined) data, such as images in combination with DataTemplates (which are designed to be used in data-binding approach) for the Headers of the RadTabItems.

In declaratively defined RadTabItems, you can set the RadTabItem.Header property to your custom layout (without using DataTemplates). By doing so you will be able to change the Source of the images property in code-behind when the SelectionChanged event is triggered.

Take a look at the attached project and let me know if it works in your scenario.

All the best,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Virag
Top achievements
Rank 1
answered on 06 Nov 2012, 03:38 PM
Hi Pavel,

Thanks for you help . It is almost the same what I needed .

Thanks a lot :)

Tags
TabControl
Asked by
Virag
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Virag
Top achievements
Rank 1
Share this question
or