Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Legend.ItemTemplate Property

Gets or sets a data template that specifies how to display an item in the legend.

Namespace: DevExpress.Xpf.TreeMap

Assembly: DevExpress.Xpf.TreeMap.v24.2.dll

NuGet Package: DevExpress.Wpf.TreeMap

#Declaration

public DataTemplate ItemTemplate { get; set; }

#Property Value

Type Description
DataTemplate

Specifies how to display an item in the legend.

#Remarks

Specify the Legend.ItemTemplate property to configure legend item appearance.

The following example shows how to display circular markers instead of rectangular markers in the legend:

Circular legend markers

<dxtm:TreeMapControl.Legend>
    <dxtm:Legend HorizontalPosition="Center" VerticalPosition="BottomOutside" 
                 Margin="10" Height="80"  Padding="4" Direction="TopToBottom" 
                 BorderBrush="DarkGray" BorderThickness="1">
        <dxtm:Legend.Title>
            <dxtm:LegendTitle Content="Field of Activity" FontSize="14" FontWeight="Bold"/>
        </dxtm:Legend.Title>
        <dxtm:Legend.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <Ellipse Width="10" Height="10" Fill="{Binding Brush}" Margin="2,0"/>
                    <TextBlock Text="{Binding Text}"/>
                </StackPanel>
            </DataTemplate>
        </dxtm:Legend.ItemTemplate>
    </dxtm:Legend>
</dxtm:TreeMapControl.Legend>
See Also