<Style x:Key="RadTabControlStyle">
<Setter Property="telerikNavigation:RadTabControl.ItemContainerStyle">
<Setter.Value>
<Style TargetType="telerikNavigation:RadTabItem">
<Setter Property="FontFamily" Value="Tahoma"/>
<Setter Property="Foreground" Value="White"/>
<!--Setting the template for the headers.-->
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<WrapPanel Margin="3">
<Image Source="{Binding}" Height="25" />
<TextBlock Text="{Binding}" FontSize="15" TextAlignment="Center" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="110" >
</TextBlock>
</WrapPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="False">
<Setter Property="BorderThickness" Value="0.5" />
<Setter Property="BorderBrush" Value="LightGray" />
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
</Style>
This is the style I am applying to radTabcontrol and Binding tabItem in xaml
<telerikNavigation:RadTabItem x:Name="tbAddress" Header="Address" Foreground="Black" TabIndex="2" HorizontalAlignment="Left">
<ctrl:AddressControl x:Name="ctrlAddress" ></ctrl:AddressControl>
</telerikNavigation:RadTabItem>
I am not assigning any ItemSource to tabControl,It works great it show header text with centerd align.
But problem is that I want to bind different image with this header text in tabHeader and I have mentined Image sOurce={Binding} so that I can provide image at run time
DataTemplate template = tbIdentification.HeaderTemplate as DataTemplate;
if (template == null) return;
WrapPanel pnl = template.LoadContent() as WrapPanel;
Image ImgButton = pnl.Children[0] as Image;
ImgButton.BeginInit();
ImgButton.Source = (ImageSource)new ImageSourceConverter().ConvertFrom(new Uri("pack://application:,,,/SafetyAuditUserControl;component/Images/truck.png",UriKind.RelativeOrAbsolute ));
ImgButton.EndInit();
It not showing Image.Please help me out for this ASAP.
<Setter Property="telerikNavigation:RadTabControl.ItemContainerStyle">
<Setter.Value>
<Style TargetType="telerikNavigation:RadTabItem">
<Setter Property="FontFamily" Value="Tahoma"/>
<Setter Property="Foreground" Value="White"/>
<!--Setting the template for the headers.-->
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<WrapPanel Margin="3">
<Image Source="{Binding}" Height="25" />
<TextBlock Text="{Binding}" FontSize="15" TextAlignment="Center" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="110" >
</TextBlock>
</WrapPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="False">
<Setter Property="BorderThickness" Value="0.5" />
<Setter Property="BorderBrush" Value="LightGray" />
</Trigger>
</Style.Triggers>
</Style>
</Setter.Value>
</Setter>
</Style>
This is the style I am applying to radTabcontrol and Binding tabItem in xaml
<telerikNavigation:RadTabItem x:Name="tbAddress" Header="Address" Foreground="Black" TabIndex="2" HorizontalAlignment="Left">
<ctrl:AddressControl x:Name="ctrlAddress" ></ctrl:AddressControl>
</telerikNavigation:RadTabItem>
I am not assigning any ItemSource to tabControl,It works great it show header text with centerd align.
But problem is that I want to bind different image with this header text in tabHeader and I have mentined Image sOurce={Binding} so that I can provide image at run time
DataTemplate template = tbIdentification.HeaderTemplate as DataTemplate;
if (template == null) return;
WrapPanel pnl = template.LoadContent() as WrapPanel;
Image ImgButton = pnl.Children[0] as Image;
ImgButton.BeginInit();
ImgButton.Source = (ImageSource)new ImageSourceConverter().ConvertFrom(new Uri("pack://application:,,,/SafetyAuditUserControl;component/Images/truck.png",UriKind.RelativeOrAbsolute ));
ImgButton.EndInit();
It not showing Image.Please help me out for this ASAP.