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

How can I set the style DocumentHost in my xaml code ?

1 Answer 38 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Gilmar
Top achievements
Rank 1
Gilmar asked on 11 Mar 2013, 12:52 PM
How can I set the style DocumentHost in my xaml code ?
I got the file by changing the style of Telerik.Windows.Controls.Docking, 
however I would like to change only the resources of my object now that I have other controls radDocking 
and I would not change at all.

Below is my code <
Style x:Key="DocumentHostStyle" TargetType="dock:DocumentHost"             <Setter Property="HorizontalContentAlignment" Value="Stretch" />             <Setter Property="VerticalContentAlignment" Value="Stretch" />             <Setter Property="MinWidth" Value="25" />             <Setter Property="MinHeight" Value="25" />             <Setter Property="Template">               <Setter.Value>                 <ControlTemplate TargetType="dock:DocumentHost"> <!--My code changed with StackPanel -->                   <StackPanel>                     <telerik:RadExpander>                       <Rectangle Height="100" Fill="Blue"/>                     </telerik:RadExpander>                     <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">                       <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />                     </Border>                   </StackPanel>                 </ControlTemplate>               </Setter.Value>             </Setter>           </Style>

1 Answer, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 14 Mar 2013, 02:50 PM
Hello Gilmar,

There is no property to add custom style to DocumentHost in RadDocking.
I can suggest you two ways to apply custom style to DocumentHost:

  • One way is to create implicit style for TargetType="dock:DocumentHost". SiImply remove x:Key from your DocumentHost style and it will be applied.
  • Another solution is to define the style inside RadDocking like:
<telerikDocking:RadDocking >
            <telerik:RadDocking.Resources>
                <Style TargetType="dock:DocumentHost">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="VerticalContentAlignment" Value="Stretch" />
                    <Setter Property="MinWidth" Value="25" />
                    <Setter Property="MinHeight" Value="25" />
                    <Setter Property="Background" Value="Transparent" />
                    <Setter Property="AllowDrop" Value="True" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="dock:DocumentHost">
                                <StackPanel>
                                    <telerik:RadExpander>
                                        <Rectangle Height="100" Fill="Blue"/>
                                    </telerik:RadExpander>
                                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                </StackPanel>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
 
            </telerik:RadDocking.Resources>

end everything will work as expected.

I hope it helps.

Regards,
Maria
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Docking
Asked by
Gilmar
Top achievements
Rank 1
Answers by
Masha
Telerik team
Share this question
or