Reputation: 327
I'm using AvalonDock for my WPF Application and want to use data binding for changing the theme.
ViewModel:
private Theme _AvalonDockTheme = new ExpressionDarkTheme();
public Theme AvalonDockTheme
{
get
{
return _AvalonDockTheme;
}
set
{
if (_AvalonDockTheme != value)
{
_AvalonDockTheme = value;
RaisePropertyChanged("AvalonDockTheme");
}
}
}
XAML:
<xcad:DockingManager AllowMixedOrientation="True"
Theme="{Binding Source={StaticResource DockTheme}}"
x:Name="_dockingManager">
<!-- some content -->
</xcad:DockingManager>
Whe I use this I get the following error message:
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='Xceed.Wpf.AvalonDock.Themes.ExpressionDarkTheme' BindingExpression:Path=MainViewModel.AvalonDockTheme; DataItem='App' (HashCode=47182344); target element is 'CollectionViewSource' (HashCode=42887454); target property is 'Source' (type 'Object')
I don't understand why the binding fails. The binding source and target are both of type Xceed.Wpf.AvalonDock.Themes.Theme but the error message says that the target element is of type CollectionViewSource. Why?
Upvotes: 0
Views: 1074
Reputation: 4413
Take a look at this question:
Binding a CollectionViewSource within a DataTemplate
If that doesn't help, please provide DockTheme resource definition.
Upvotes: 1