This project is read-only.

Dockmanager set Theme in Resourcedictionary

Dec 6, 2016 at 4:14 PM
Edited Dec 6, 2016 at 4:36 PM
Hi,

i am using Avalondock to display my windows which works pretty perfect!
After some years of use i am now developing differnt styles (WPF, XAML) for my applications

For example, i have a dark and a light theme. One should use the avalon light theme the other one the dark theme.

I want to set the style for my application only one time in my app.xaml, therefore i wrote following code:
<Application x:Class="generics.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:generics">
    <Application.Resources>
        <ResourceDictionary Source="pack://application:,,,/style;component/Themes/Dark/theme.xaml" />
    </Application.Resources>
</Application>


<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:avalon="http://schemas.xceed.com/wpf/xaml/avalondock"
                    xmlns:system="clr-namespace:System;assembly=mscorlib">

    <SolidColorBrush x:Key="textcolor" Color="#F1F1F1" />
    <SolidColorBrush x:Key="panelbackground" Color="Transparent" />
    <SolidColorBrush x:Key="statusbarbackground" Color="#007ACC" />

    <Style TargetType="avalon:DockingManager">
        <Setter Property="Theme">
            <Setter.Value>
                <avalon:Vs2013DarkTheme />
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type StackPanel}">
        <Setter Property="Background" Value="{StaticResource panelbackground}" />
    </Style>
</ResourceDictionary>
If i use this theme, no avalon controls are displayed at all, and i am receiving an cycling reference error on the style property of the Dockingmanager.

if i set the theme in my mainwindow like this:
 <bc:DockManager Grid.Row="1" Name="bcDockingmanager">
            <bc:DockManager.Theme>
                <avalon:Vs2013DarkTheme />
            </bc:DockManager.Theme>
            <avalon:LayoutRoot>
it works fine.



Is there a way to set the avalon theme in my main theme?

KR Manuel