menu

WinUI

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

    Show / Hide Table of Contents

    Class FormatStringConverter

    Value converter that converts an System.IFormattable to a formatted System.String. The string format needs to be passed as the converter parameter.

    Inheritance
    System.Object
    FormatStringConverter
    Implements
    Microsoft.UI.Xaml.Data.IValueConverter
    Namespace: Syncfusion.UI.Xaml.Core
    Assembly: Syncfusion.Core.WinUI.dll
    Syntax
    public class FormatStringConverter : Object, IValueConverter

    Constructors

    FormatStringConverter()

    Declaration
    public FormatStringConverter()

    Methods

    Convert(Object, Type, Object, String)

    Convert an System.IFormattable value to a formatted System.String.

    Declaration
    public object Convert(object value, Type targetType, object parameter, string language)
    Parameters
    Type Name Description
    System.Object value

    The source data being passed to the target.

    System.Type targetType

    The type of the target property, as a type reference.

    System.Object parameter

    The format string.

    System.String language

    The language of the conversion. Not used.

    Returns
    Type Description
    System.Object

    The formatted string.

    Examples

    Refer to the following code example.

    [XAML]

    <StackPanel>
      <StackPanel.Resources>
           <syncfusionConverters:FormatStringConverter x:Key="formatStringConverter" />
       </StackPanel.Resources>
       <DatePicker x:Name="inputEntry" />       
       <TextBlock Text="{Binding Date,ElementName=inputEntry, Converter={StaticResource formatStringConverter},ConverterParameter='yyyy'}"/>           
    </StackPanel>

    ConvertBack(Object, Type, Object, String)

    Not implemented.

    Declaration
    public object ConvertBack(object value, Type targetType, object parameter, string language)
    Parameters
    Type Name Description
    System.Object value

    The source data being passed to the target.

    System.Type targetType

    The type of the target property, as a type reference.

    System.Object parameter

    Optional parameter. Not used.

    System.String language

    The language of the conversion. Not used.

    Returns
    Type Description
    System.Object

    The value to be passed to the target dependency property.

    Implements

    Microsoft.UI.Xaml.Data.IValueConverter
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved