Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1090
Default value converter
posted

Hey,

I want to set up a value converter that will convert something like the string "1k" in the numeric editor to the int 1000 in the bound property.

I was curious if you have any publicly exposed value converters that I could compose?  Then I could convert the string "1k" to the string "1000" and then pass the string "1000" to your value converter. This way I don't have to duplicate the actual conversion logic.

Thanks

Parents
  • 54937
    Offline posted

    The mask is not going to allow you to type in 1k - the entry is restricted based on the type of mask character the caret is positioned at - so I assume the information is coming that way from your underlying data - i.e. the property to which you are binding this? If so then perhaps you could just set the Converter on the Binding you are using to bind the Value of the editor to the underlying object property and perform the conversion that. With regards to your specific question about how to get to the default converter, its not public but there is a protected property that returns the default converter it will use.

Reply Children