 | AttachedPropertiesContainerLoadEmergencyZeroLogicalProperty field |
Attached property for a nullable Boolean for passing on the logical state
of the checker assigned to the control (is used, for example, for dependent colouring
(false=red, true=green) of a superordinate border in a ControlTemplate):
After various failed attempts, the following procedure has proven to be the only viable solution
has crystallised: a control superordinate to the ControlTemplate or
DataTemplate is assigned the AttachedProperty "LastNotNullLogical":
<Expander Name="Exp" Template="{StaticResource ExpanderStyleHeaderCentered}"
...
attached:AttachedPropertiesContainer.LastNotNullLogical="{Binding LastNotNullLogical, diag:PresentationTraceSources.TraceLevel=High}"
>
The AttachedProperty "LastNotNullLogical" is directly linked to "LastNotNullLogical" from
is bound to the DataContext, in this case "LogicalNodeViewModel".
In the subordinate ControlTemplate, here <ControlTemplate TargetType="ToggleButton">
in LogicalTaskTreeControlStaticResourceDictionary.xaml, DataTriggers are passed to the higher-level
Control with Path bound to the AttachedProperty "LastNotNullLogical":
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}},
Path=(attached:AttachedPropertiesContainer.LastNotNullLogical)}" Value="True">
<Setter Property = "Border.BorderBrush" TargetName="ToggleButtonBorder" Value="{StaticResource ItemBorderBrushGreen}" />
</DataTrigger>
<DataTrigger Binding = "{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}},
Path=(attached:AttachedPropertiesContainer.LastNotNullLogical)}" Value="False">
<Setter Property = "Border.BorderBrush" TargetName = "ToggleButtonBorder" Value = "{StaticResource ItemBorderBrushRed}" />
</ DataTrigger>
Important note: other solution approaches failed at the latest when the tree orientation was switched.
Namespace: Vishnu.WPF_UI.DependencyPropertiesAssembly: Vishnu.WPF_UI (in Vishnu.WPF_UI.dll) Version: 1.0.0+df0404e911d6c38eaed3bb1bb1acfc482d417643
Syntaxpublic static readonly DependencyProperty LastNotNullLogicalProperty
Public Shared ReadOnly LastNotNullLogicalProperty As DependencyProperty
public:
static initonly DependencyProperty^ LastNotNullLogicalProperty
static val LastNotNullLogicalProperty: DependencyProperty
Field value
DependencyProperty
See also