 | AttachedPropertiesContainer fields |
The AttachedPropertiesContainer Type exposes the following members.
Fields| | Name | Description of the |
|---|
  | HasParentProperty |
In True, the node has a parent node,
if False, it is the root.
|
  | LastNotNullLogicalProperty |
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.
|
  | ParentChildOrientationProperty |
Alignment of the child nodes, horizontal or vertical.
|
Back to the top
See also