Xceed Toolkit for .NET Maui v2.0 Documentation
Xceed.Maui.Toolkit Assembly / Xceed.Maui.Toolkit Namespace / Chart Class / Legend Property
Example


    Legend Property
    Gets or sets the Chart's Legend.
    Syntax
    'Declaration
     
    
    Public Property Legend As Legend
     
    'Usage
     
    
    Dim instance As Chart
    Dim value As Legend
     
    instance.Legend = value
     
    value = instance.Legend
    Remarks

    This property makes it possible to create a customized Legend for the Chart.

    Note, however, that the Chart already has a default Legend built-in. 

    Also note that in order to see the Legend appear, the ShowLegend property must be set to true

    Example
    <xctk:Chart.Legend>
      <xctk:Legend Title="My Legend">
        <xctk:Legend.SeriesItemTemplate>
          <DataTemplate>
            <ViewCell>
              <HorizontalStackLayout>
                <Ellipse Fill="{Binding Background}"
                         HeightRequest="16"
                         WidthRequest="16"/>
                <Label Margin="4"
                       FontAttributes="Italic"
                       FontSize="12"
                       Text="{Binding Text}"
                       TextColor="Blue"
                       VerticalOptions="Center"/>
              </HorizontalStackLayout>
            </ViewCell>
          </DataTemplate>
        </xctk:Legend.SeriesItemTemplate>
      </xctk:Legend>
    </xctk:Chart.Legend>
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also