Formatting not Bindable / Updating

Hi,

i want to bind the formating to property in the ViewModel but it doesn't update. Is it possible to set the default formatting to the current culture?

 XAML

<sfPic:SfDatePicker ShowHeader="False" Format="dd_MM_yyyy" />

<sfPic:SfDatePicker ShowHeader="False" Format="{Binding CultureDateFormat}" />

ViewModel

public string CultureDateFormat

        {

            get

            {

                string pattern = System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern.Replace(".", "_");

                return pattern;

            }

        }

Result

Capture1.PNG

Thanks,

Andreas



1 Reply

VV Vijayakumar Viswanathan Syncfusion Team June 9, 2022 02:25 PM UTC

Hi Andreas,


Query 1: I want to bind the formatting to the property in the ViewModel but it doesn't update.


In the provided code snippet you have used the string data type for the DateFormat property. Now we changed that into an enum type and we prepared a sample for your reference please get it from the attachments.


Query 2: Is it possible to set the default formatting to the current culture?


We don't know the exact details of this query. Are you trying to change the date format based on the culture? What are the factors you have considered to change the date format?


Please let us know if you need any other details.


Thanks,
Vijayakumar V


Attachment: PickerFormatSample_4e9e96cf.zip

Loader.
Up arrow icon