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

2 posts, 0 answers
  1. Gilmar
    Gilmar avatar
    19 posts
    Member since:
    Jul 2010

    Posted 11 Mar 2013 Link to this post

    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>
  2. Masha
    Masha avatar
    358 posts

    Posted 14 Mar 2013 Link to this post

    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 >
                    <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">
                                <ControlTemplate TargetType="dock:DocumentHost">
                                            <Rectangle Height="100" Fill="Blue"/>
                                        <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}" />

    end everything will work as expected.

    I hope it helps.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top