menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class LabelStyle - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class LabelStyle

    LabelStyle class is used to customize the text properties such as font family, size, and foreground.

    Inheritance
    System.Object
    LabelStyle
    Namespace: Syncfusion.UI.Xaml.Charts
    Assembly: Syncfusion.Chart.WinUI.dll
    Syntax
    public class LabelStyle : DependencyObject

    Constructors

    LabelStyle()

    Initializes a new instance of the LabelStyle class.

    Declaration
    public LabelStyle()

    Fields

    FontFamilyProperty

    The DependencyProperty for FontFamily property.

    Declaration
    public static readonly DependencyProperty FontFamilyProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    FontSizeProperty

    The DependencyProperty for FontSize property.

    Declaration
    public static readonly DependencyProperty FontSizeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    ForegroundProperty

    The DependencyProperty for Foreground property.

    Declaration
    public static readonly DependencyProperty ForegroundProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    LabelFormatProperty

    The DependencyProperty for LabelFormat property.

    Declaration
    public static readonly DependencyProperty LabelFormatProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty

    Properties

    FontFamily

    Gets or sets a value to customize the font family for label.

    Declaration
    public FontFamily FontFamily { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.Media.FontFamily

    FontSize

    Gets or sets a value to customize the font size for label.

    Declaration
    public double FontSize { get; set; }
    Property Value
    Type
    System.Double

    Foreground

    Gets or sets a value to customize the foreground color for label.

    Declaration
    public SolidColorBrush Foreground { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.Media.SolidColorBrush

    LabelFormat

    Gets or sets the value for the label formatting.

    Declaration
    public string LabelFormat { get; set; }
    Property Value
    Type
    System.String
    Examples
    • MainPage.xaml
    • MainPage.xaml.cs
    <chart:SfCartesianChart>
    
        <chart:SfCartesianChart.XAxes>
            <chart:DateTimeAxis >
               <chart:DateTimeAxis.LabelStyle>
                   <chart:LabelStyle LabelFormat = "MMM-dd" />
               </chart:DateTimeAxis.LabelStyle>
        </chart:DateTimeAxis>
        </chart:SfCartesianChart.XAxes>
    
    </chart:SfCartesianChart>
    SfCartesianChart chart = new SfCartesianChart();
    
    LabelStyle labelStyle = new LabelStyle()
    {
        LabelFormat = "MMM-dd",
    }
    DateTimeAxis xaxis = new DateTimeAxis()
    {
        LabelStyle = labelStyle,
    }
    
    chart.XAxes.Add(xaxis);
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved