<DataTemplate x:Key="HeaderTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}"/>
<Image Source="Icon.jpg" Width="16" Height="16"/>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
Any help is appreciated.
Thanks.
11 Answers, 1 is accepted
Thank you for your interest in RadDocking.
There are two approaches which you can take:
1. You can set a different DataTemplate for each RadPane in XAML only. You can link the DataTemplate you have manually to a particular RadPane as a regular Staticresource in XAML:
<
telerikDock:RadPane
HeaderTemplate
=
"{StaticResource HeaderTemplate}"
>
...
</
telerikDock:RadPane
>
2. You can use the HeaderTemplateSelector property of RadPane which will switch between DataTemplates programatically.
The HeaderTemplateSelector must inherit the DataTemplateSelector class, which is located in the Telerik.Windows.Controls assembly. Override the SelectTemplate method and implement your custom logic in it.
The HeaderTemplateSelector must be defined as a resource in XAML before using it as a property of RadPane.
I hope this information is helpful.
Greetings,
Dani
the Telerik team
<
UserControl
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:d
=
"http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc
=
"http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable
=
"d"
x:Class
=
"DockingSL.MainPage1"
Width
=
"640"
Height
=
"480"
>
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"HeaderTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding}"
/>
<
TextBlock
Text
=
"{Binding Text}"
/>
</
StackPanel
>
</
DataTemplate
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
>
<
telerik:RadDocking
x:Name
=
"radDocking"
>
<
telerik:RadDocking.DocumentHost
>
<
telerik:RadPaneGroup
TabStripPlacement
=
"Top"
x:Name
=
"radPaneGroup"
>
<
telerik:RadDocumentPane
Header
=
"Welcome"
>
<
telerik:RadSplitContainer
Orientation
=
"Vertical"
>
<
telerik:RadPaneGroup
x:Name
=
"rpgGrid"
>
<
telerik:RadPane
Header
=
"{Binding ElementName=viewer1}"
HeaderTemplate
=
"{StaticResource HeaderTemplate}"
>
<
TextBlock
x:Name
=
"viewer1"
Text
=
"V1"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
<
telerik:RadPaneGroup
>
<
telerik:RadPane
Header
=
"{Binding ElementName=viewer2}"
HeaderTemplate
=
"{StaticResource HeaderTemplate}"
>
<
TextBlock
x:Name
=
"viewer2"
Text
=
"V2"
/>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocumentPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadDocking.DocumentHost
>
</
telerik:RadDocking
>
</
Grid
>
</
UserControl
>
Please use the TitleTemplate and the Title property to set the header in the way you wish. Also, update your Binding to have the text property as Path:
<
telerik:RadPane
Title
=
"{Binding Text, ElementName=viewer1}"
TitleTemplate
=
"{StaticResource HeaderTemplate}"
>
<
TextBlock
x:Name
=
"viewer1"
Text
=
"Test this!"
/>
</
telerik:RadPane
>
I hope this will be helpful.
Greetings,
Dani
the Telerik team
any help would be greatly appreciated
Simply use the HeaderTemplate property of RadPane. Attached is a demonstration.
Hope this will be helpful.
Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Have a got any possibility?
Thanks
I have modified the project in order to demonstrate how you could bind Visibility property of the Icon to a property in the ViewModel. Please download it and give it a try.
Regards,Maria
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Now it is only visible at the bottom.
When pane is in floating-state, you don't see the icon.
Thanks in advance.
Sarah
In order to apply an Icon to the RadPane, you should change all four control templates inside RadPaneStyle to reflect changes everywhere. The below example demonstrated the approach only for the BottomTemplate. When RadPane is unpinned a new ToolWindow is created, so you need to modify the ToolWindowStyle.
Hope this helps.
All the best,
Maria
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Hello Sathish,
There is no code sample showing this.
However, you can achieve it by customizing the RadPane templates. Basically, can extract the RadPaneStyle along with its ControlTemplate - Template, LeftTemplate, TopTemplate, RightTemplate, BottomTemplate and DocumentHostTemplate. Then you will need to find the RadButton controls that show the pinned and unpinned icons and replace their content with your custom icon.
After this you can apply the customized style and templates using an implicit style targeting the RadPane elements.
Regards,
Martin Ivanov
Progress Telerik