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

Different styles for ToolWindow

1 Answer 100 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Marcelo
Top achievements
Rank 1
Marcelo asked on 16 Apr 2012, 03:18 PM
Hi guys,

I'm using the RadDocking control to show some charts and grids.
Today, the user can set the RadPanel as Float and save it.

I have a property on my ViewModel that says if User can make changes on these panels. Let's call it "IsAllowChanges".

What I want is, when IsAllowChanges is false, set the Header, Background and borders of "Float" RadPane to "Transparent". And come back to original Header, Background and borders when IsAllowChanges is true.

As the RadDocking don't allow me to set the ToolWindow's Style directly, I did a general style. 

<SolidColorBrush x:Key="ToolWindow_Background" Color="Transparent"/>
        <SolidColorBrush x:Key="ToolWindow_OuterBorderBrush" Color="Transparent"/>
        <telerik:Office_BlackTheme x:Key="Theme"/>
        <SolidColorBrush x:Key="ToolWindow_InnerBorderBrush" Color="Transparent"/>
        <Style TargetType="telerik:RadSplitContainer">
            <Setter Property="InitialPosition" Value="DockedLeft"/>
            <Setter Property="Background" Value="{StaticResource ToolWindow_Background}"/>
        </Style>
        <Style TargetType="telerik:RadPaneGroup">
            <Setter Property="Background" Value="{StaticResource ToolWindow_Background}"/>
        </Style>       
        <DataTemplate x:Key="toolWindowTemplate">
             
        </DataTemplate>
         
        <Style TargetType="telerik:ToolWindow">
         
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="Background" Value="{StaticResource ToolWindow_Background}"/>
            <Setter Property="BorderBrush" Value="{StaticResource ToolWindow_OuterBorderBrush}"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:ToolWindow">
                        <Grid x:Name="VisualRoot" Background="Transparent">
                            <Border Background="Transparent">
                                <!--<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" CornerRadius="4">
                                    <Border BorderBrush="{StaticResource ToolWindow_InnerBorderBrush}" BorderThickness="1" CornerRadius="3">-->
                                        <Grid Background="Transparent">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="*"/>
                                            </Grid.RowDefinitions>
                                            <!--<Border x:Name="HeaderElement" Background="Transparent" Grid.Column="0" Padding="3 1" Grid.Row="0">
                                                <telerik:CommandManager.InputBindings>
                                                    <telerik:InputBindingCollection>
                                                        <telerik:MouseBinding Command="telerikDocking:RadDockingCommands.PaneHeaderMenuOpen">
                                                            <telerik:MouseBinding.Gesture>
                                                                <telerik:MouseGesture MouseAction="RightClick"/>
                                                            </telerik:MouseBinding.Gesture>
                                                        </telerik:MouseBinding>
                                                    </telerik:InputBindingCollection>
                                                </telerik:CommandManager.InputBindings>
                                                <ContentPresenter x:Name="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}"/>
                                            </Border>
                                            <telerik:RadButton x:Name="CloseButton" Grid.Column="1" Command="telerik:WindowCommands.Close" Margin="1 1 3 1" Grid.Row="0" Style="{StaticResource ToolWindow_CloseButtonStyle}"/>-->
                                            <ContentPresenter x:Name="Content" Grid.ColumnSpan="2" Content="{TemplateBinding Content}" Margin="3 0 3 3" Grid.Row="1"/>
                                        </Grid>
                                    </Border>
                                <!--</Border>
                            </Border>-->
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        

The problem is, how would I change the styles propertys (or the entire style of the ToolWindow ) when the IsAllowChanges changes?

I don't know if I made myself clear, so see on attachments an example...

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 18 Apr 2012, 04:11 PM
Hello Marcelo,

As the style you use is implicit, it always gets applied to ToolWindows. You can either set it a key and make it explicit and then have two different explicit ToolWindow styles in order to apply them conditionally. Or you can leave it as implicit, place it in a separate resource dictionary and have another resource dictionary with the second implicit ToolWindow style. You can then dynamically add or remove resource dictionaries to the merged dictionaries collection in App.xaml.cs depending on which style you need.

I hope this will be helpful.


Regards,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Docking
Asked by
Marcelo
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or