Selection Support in WPF TreeMap (SfTreeMap)

10 May 20212 minutes to read

While selecting a leaf node, you can highlight it by setting HighlightOnSelection property of SfTreeMap to “True”. The border of highlight on selection can be customized by HighlightBorderBrush and HighlightBorderThickness properties of SfTreeMap. SelectionMode can also be set to either “Default” or “Multiple”. “Multiple” selection of leaf nodes is made possible by pressing the control key continuously while Mouse Click happens.

  • XAML
  • <syncfusion:SfTreeMap Name="TreeMap" ItemsSource="{Binding PopulationDetails}" 
    
                           WeightValuePath="Population"                              
    
                           ColorValuePath="Growth"
    
                           HighlightOnSelection="True"
    
                           HighlightBorderBrush="Red"
    
                           HighlightBorderThickness="4"
    
                           HighlightHoverBrush="Yellow"
    
                           SelectionModes="Multiple">
    
    </syncfusion:SfTreeMap>

    Selection Support_images

    GroupSelection support is also provided under selection support where the whole group can be selected. While selecting a leaf node, you can highlight it by setting HighlightGroupOnSelection property of SfTreeMap to “True”. The helper properties, HighlightBorderBrush, HighlightBorderThickness, and SelectionModes are shared for both HighlightOnSelection and HighlightGroupOnSelection.

  • XAML
  • <syncfusion:SfTreeMap Name="TreeMap" ItemsSource="{Binding PopulationDetails}" 
    
                           WeightValuePath="Population"                              
    
                           ColorValuePath="Growth"
    
                           HighlightGroupOnSelection="True"
    
                           HighlightBorderBrush="Red"
    
                           HighlightBorderThickness="4"
    
                           SelectionModes="Multiple" >
    
            </syncfusion:SfTreeMap>

    GroupSelection support_images

    see also

    How to highlight group selection