Skip to main content
A newer version of this page is available. .

MapLegendBase.ItemLabelTemplate Property

Gets or sets the template that specifies the visual representation of the legend’s item labels.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v21.2.dll

NuGet Package: DevExpress.Wpf.Map

Declaration

public DataTemplate ItemLabelTemplate { get; set; }

Property Value

Type Description
DataTemplate

The DataTemplate object that specifies the visual representation of the legend’s item labels.

Example

This example demonstrates how to customize a map legend’s items using the legend’s ColorLegend.ItemTemplate and MapLegendBase.ItemLabelTemplate properties. The legend uses these templates to create visual representations of a legend’s items and legend item labels.

Note that templates use the MapLegendItemBase and its descendant classes’ objects as the DataContext property value.

<dxm:ColorListLegend Layer="{Binding ElementName=vectorLayer}"
                     Header="GDP">
    <dxm:ColorListLegend.ItemTemplate>
        <DataTemplate>
            <StackPanel Margin="4,2,4,2" 
                        Orientation="Horizontal" >
                <Ellipse Width="16" 
                         Height="16" 
                         Fill="{Binding Fill}"/>
                <ContentControl Margin="8, 0, 0, 0" 
                                Content="{Binding}" 
                                ContentTemplate="{Binding Path=LabelTemplate}"/>
            </StackPanel>
        </DataTemplate>
    </dxm:ColorListLegend.ItemTemplate>
    <dxm:ColorListLegend.ItemLabelTemplate>
        <DataTemplate>
            <TextBlock Height="16" 
                       VerticalAlignment="Center"
                       Text="{Binding Value, Converter={StaticResource valueConverter}}"/>
        </DataTemplate>
    </dxm:ColorListLegend.ItemLabelTemplate>
</dxm:ColorListLegend>
See Also