Skip to main content

MapLegendItemBase.LabelTemplate Property

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

Namespace: DevExpress.Xpf.Map

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

NuGet Package: DevExpress.Wpf.Map

Declaration

[Browsable(false)]
public DataTemplate LabelTemplate { get; set; }

Property Value

Type Description
DataTemplate

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

Remarks

The value of this property is assigned from the MapLegendBase.ItemLabelTemplate property.

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