Theme getting Broken

2 posts, 0 answers
  1. Tyler
    Tyler avatar
    13 posts
    Member since:
    Jun 2012

    Posted 13 Sep 2012 Link to this post

    I'm working on a project in which I am trying to make all the windows dockable. I have had success doing this but am having one small problem. I have the theme set at Expression_Dark for everything and when I undock one of the windows everything is fine, but when I dock it back anywhere on the screen the theme is broken on that specific pane and the color changes back to default. How can I fix this problem and reset the theme. I was going to invoke the panestatechange event and reset the theme from there but cant figure out the correct code to put within the event. My code for the xaml is posted below...any help would be appreciated. Thanks.
    <ui:UserControlBase x:Class="CommandAlkon.COMMANDtrack.UserInterface.Controls.Dashboard"
        xmlns:ui="clr-namespace:CommandAlkon.COMMANDtrack.UserInterface.Bases"
        Background="Transparent"
        xmlns:parts="clr-namespace:CommandAlkon.COMMANDtrack.UserInterface.Controls.DashboardParts">
      
        <Grid>
            <telerik:RadDocking  BorderThickness="0" Padding="0" IsRestricted="True" RestrictedAreaMargin="100,100,100,100" telerik:StyleManager.Theme="Expression_Dark" >
      
                <telerik:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft">
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                        <telerik:RadPane Header="Regions" CanUserClose="False" CanDockInDocumentHost="True">
                            <telerik:RadPane.Content>
                                <Border x:Name="BorderMainRegion" Grid.Row="1" CornerRadius="0,0,10,10" BorderThickness="0,1,0,0" Margin="2" >
                                <ListBox x:Name="RegionsListBox" />
                                </Border>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                        <telerik:RadPane Header="Plants" CanUserClose="False" >
                            <telerik:RadPane.Content>
                                <Border x:Name="BorderMainPlant" Grid.Row="1" CornerRadius="0,0,10,10"  BorderThickness="0,1,0,0" Margin="2" >
                                <ListBox x:Name="PlantsListBox" />
                                </Border>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
      
                <telerik:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedTop" Height="300" telerik:StyleManager.Theme ="Expression_Dark">
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                        <telerik:RadPane Name="PlantChartPane" Header="Plant" CanUserClose="False" >
                            <telerik:RadPane.Content>
                                <Border x:Name="BorderPlantChart" Grid.Row="1" CornerRadius="0,0,10,10" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0" Padding="2,0,2,3"/>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                        <telerik:RadPane Header="Schedule" CanUserClose="False">
                            <telerik:RadPane.Content>
                                <Border x:Name="BorderMainGrid" Grid.Row="1" CornerRadius="0,0,10,10" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0">
                                <ui:SchedulingControl x:Name="ScheduleLateness" IsScheduleLatenessControl="True"  />
                                </Border>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                        <telerik:RadPane Name="TrucksChartPane" Header="Trucks" CanUserClose="False" />
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
      
                <telerik:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedBottom" Height="150" >
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                        <telerik:RadPane Name="ExceptionsPane" Header="Exceptions" CanUserClose="False" >
                            <telerik:RadPane.Content>
                                <parts:Exceptions Grid.Column="0"/>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark" >
                        <telerik:RadPane Header="Suggestions" CanUserClose="False" >
                            <telerik:RadPane.Content>
                                <parts:Suggestions Grid.Column="0" />
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
      
                <telerik:RadSplitContainer InitialPosition="DockedRight" Width="700">
                    <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark" >
                        <telerik:RadPane Header="Loads" CanUserClose="False">
                            <telerik:RadPane.Content>
                                <parts:Loads Grid.Column="0" />
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
                  
            </telerik:RadDocking>
        </Grid>
    </ui:UserControlBase>
  2. Georgi
    Admin
    Georgi avatar
    350 posts

    Posted 18 Sep 2012 Link to this post

    Hello Tyler,

    It seems like this is happening because when you undock a Pane a new ToolWindow is generated and the content of the Pane is put as a content of the ToolWindow. So the new generated ToolWindow does not have any theme set and therefore it gets its default theme.
    What you can do is use implicit styles to set the theme as shown in this help article or just use an AplicationTheme:
    public MainWindow()
      {
         StyleManager.ApplicationTheme = new Expression_DarkTheme();
         InitializeComponent();
      }

    It would be great if you can give it a try and let us know if this works for you.

    All the best,
    Georgi
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top