Hi was hoping you could help me, I’m using your “Custom Context Content” example from Docking/MDI – Quickstarts. Using the red or green Ellipse in the datatemplate.
I’m trying to bind the ellipse to a Boolean property from my VM which I have managed, this breaks the DataContext for the visual tree for anything within the ToolWindow. I can fix this by Binding the DataContext for the next control in the ToolWindow using RelativeSource etc. The problem is I’m using another binding on another property on the ToolWindow (TabTintColor binding) but can’t workout how to bind the property as the DataContext has been redirected.
Is there any way to bind multiple properties on the ToolWindow? Or re hash the DataTemplate?
<ribbon:RibbonWindow.Resources>
<shared:ConditionalConverter x:Key="StatusLightConditionalConverter">
<shared:ConditionalConverter.TrueValue>
<SolidColorBrush Color="#5cd404" />
</shared:ConditionalConverter.TrueValue>
<shared:ConditionalConverter.FalseValue>
<SolidColorBrush Color="#d40404" />
</shared:ConditionalConverter.FalseValue>
</shared:ConditionalConverter>
<DataTemplate x:Key="StatusIconDataTemplate">
<Ellipse Margin="2" Width="12" Height="12" StrokeThickness="1" Stroke="#ffffff" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{Binding Converter={StaticResource StatusLightConditionalConverter}}" />
</DataTemplate>
</ribbon:RibbonWindow.Resources>
...
<dock:ToolWindow TabTintColor="{Binding MyValidConnection, Mode=OneWay, Converter={StaticResource B2Col}}"
AutoHideTabContextContentTemplate="{StaticResource StatusIconDataTemplate}"
StandardMdiTitleBarContextContentTemplate="{StaticResource StatusIconDataTemplate}"
TabbedMdiTabContextContentTemplate="{StaticResource StatusIconDataTemplate}"
ToolWindowContainerTabContextContentTemplate="{StaticResource StatusIconDataTemplate}"
ToolWindowContainerTitleBarContextContentTemplate="{StaticResource StatusIconDataTemplate}" >
<dock:ToolWindow.DataContext>
<Binding Path="MyValidConnection"/>
</dock:ToolWindow.DataContext>
<DockPanel DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainView}}, Path=DataContext}">
...
</DockPanel>
</dock:ToolWindow>