Click or drag to resize

AttachedPropertiesContainer Attached properties

The AttachedPropertiesContainer Type exposes the following members.

Attached properties
 NameDescription of the
Public PropertyHasParent Attached property (bool). If true, the node has child nodes.
Public PropertyLastNotNullLogical 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.
Public PropertyParentChildOrientation Attached Property (Orientation), Horizontal or Vertical.
Back to the top
See also