-
Notifications
You must be signed in to change notification settings - Fork 105
Controls highlighting and visibility manipulation
< Back to contents >
Last checked against version: 2.1.8
Please note that default template doesn't contain highlighting. Please refer to ShowcaseApp.WPF app (Themed Graph) to see an example.
Highlight function works through attached properties mechanics and supports 2 types of visual controls: VertexControl and EdgeControl. MouseEnter / MouseLeave events are used to track down highlighting time.
HighlightBehaviour static class supports several settings to define how the highlighting exactly works:
- IsHighlightEnabled = true/false - specifies that behavior is enabled and corresponding events are listened.
- HighlightControl = Vertex/Edge/VertexAndEdge – specifies what control types will be affected by highlighting.
- HighlightEdges = In/Out/All – specifies exact edge types affected by highlighting (if any)
- HighlightStrategy – not yet implemented.
- Highlighted – specifies that control has been highlighted. By default it is set automatically but you can change this property directly to manualy control highlighting feature.
Basicaly all you need is to define the settings (if you are not satisfied with default values) and use XAML Style triggers for the property Highlighted, for ex.:
<Setter Property="local:HighlightBehaviour.IsHighlightEnabled" Value="True" /> <Setter Property="local:HighlightBehaviour.HighlightControl" Value="VertexAndEdge" /> <Setter Property="local:HighlightBehaviour.HighlightEdges" Value="Out"/> <Style.Triggers> <Trigger Property="local:HighlightBehaviour.Highlighted" Value="True"> <Setter Property="Background" Value="Gold"/> </Trigger> <Trigger Property="local:HighlightBehaviour.Highlighted" Value="False "> <Setter Property="Background" Value="#FFE3E3E3"/> </Trigger> </Style.Triggers>
This one will color Background property of the control into Gold color.
TIP: It is possible to change Visibility property of the control on trigger so related controls will be shown/hidden on mouse over (Note that controls must exist for that to happen).
In the terms of performance edge controls are not created automatically though you can do it manually using GraphArea. GenerateAllEdges() and GraphArea. GenerateEdgesForVertex() to generate all possible edges or edges for specified vertex only. Or you can use additional parameters in a call to GenerateGraph and RelayoutGraph to generate visual edges.