A generic converter that will parse a string using the format of a the supplied NumberType.
Also can be used in a Binding.ValidatinRules set as a ValidationRule
By rights, this should be a generic class, but XAML 3.5 doesn't support generics just yet (4.0 will.) Also, not that this Converter only works with Value types.
Public Member Functions |
|
object | Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
Converts the Value to a string. |
|
object | ConvertBack (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
Converts a String back to a specific type,
determined by the NumberType property. |
|
override ValidationResult | Validate (object value, System.Globalization.CultureInfo cultureInfo) |
Will validate that a given input value (a
string) can be parsed by the TryParse function of a the type
specified by NumberType. |
|
Properties |
|
Type |
NumberType [get, set] |
The Type that this converter operates on.
|
object WPFCustomControls::Converters::NumberToStringConverter::Convert | ( | object | value, |
Type | targetType, | ||
object | parameter, | ||
System.Globalization.CultureInfo | culture | ||
) | [inline] |
Converts the Value to a string.
value | The value to convert. |
targetType | not used |
parameter | not used |
culture | not used |
object WPFCustomControls::Converters::NumberToStringConverter::ConvertBack | ( | object | value, |
Type | targetType, | ||
object | parameter, | ||
System.Globalization.CultureInfo | culture | ||
) | [inline] |
Converts a String back to a specific type, determined by the NumberType property.
The string is parsed using the current system local and number format.
value | The String value to parse. |
targetType | not used |
parameter | not used |
culture | not used |
override ValidationResult WPFCustomControls::Converters::NumberToStringConverter::Validate | ( | object | value, |
System.Globalization.CultureInfo | cultureInfo | ||
) | [inline] |
Will validate that a given input value (a string) can be parsed by the TryParse function of a the type specified by NumberType.
value | The value to check. |
cultureInfo | not used |
Type
WPFCustomControls::Converters::NumberToStringConverter::NumberType
[get, set] |
The Type that this converter operates on.
Default value is Int32