Hi everyone,
I’m trying to use MaskedTextBox outside from a Datagrid and to bind its Mask property:
<xcdg:MaskedTextBox x:Name=”msk” Value=”10″ ValueDataType=”{x:Type sys:Single}” Height=”20″ Mask=”{Binding Converter={StaticResource MyConvDeTest}}”/>
My converter is like this:
public class MyConvDeTest : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Person supplier = value as Person;
if (supplier == null) return null;
string symbol = string.Empty;
if (supplier.Symbol != null)
symbol = ” ” + supplier.Symbol;
return “#.# ” + symbol;
}
So this idea is to provide a dynamic mask to my MaskedTextBox depending of the object binded.
But it always launch an exception: The mask cannot be applied to the current text. (in MaskCoerceValueCallback.
So how can I bind the mask to my object?
Imported from legacy forums. Posted by Richard (had 2416 views)