If you bind a text control to a value that is not a string, the data binding engine will convert the value to a string. If the value is a reference type, the data binding engine will retrieve the string value by calling [**ICustomPropertyProvider.GetStringRepresentation**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.data.icustompropertyprovider.getstringrepresentation) or [**IStringable.ToString**](/windows/win32/api/windows.foundation/nf-windows-foundation-istringable-tostring) if available, and will otherwise call [**Object.ToString**](/dotnet/api/system.object.tostring#System_Object_ToString). Note, however, that the binding engine will ignore any `ToString` implementation that hides the base-class implementation. Subclass implementations should override the base class `ToString` method instead. Similarly, in native languages, all managed objects appear to implement [**ICustomPropertyProvider**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.data.icustompropertyprovider) and [**IStringable**](/windows/win32/api/windows.foundation/nn-windows-foundation-istringable). However, all calls to `GetStringRepresentation` and `IStringable.ToString` are routed to `Object.ToString` or an override of that method, and never to a new `ToString` implementation that hides the base-class implementation.
0 commit comments