Reputation: 181
I just recently re-imaged my machine and re-installed Visual Studio 2015.
I have a project that is throwing a fit over Xceeds MaskedTextBox that was not occuring before the re-install.
In my XAML:
<xctk:MaskedTextBox x:Name="Mtb" PreviewMouseDown="MaskedTextBox_PreviewMouseDown" Mask="(###) ###-####" Value="{Binding SearchNumber}"
ValueDataType="{x:Type s:String}" Height="29" IncludeLiteralsInValue="False" Width="186" FontSize="16" AutoMoveFocus="True" Style="{DynamicResource MaskedTextBoxStyle}">
Now, in designer I am getting an "ArgmentException: The Value representation 'SearchNumber' does not match the mask. Parameter name:value.
The project still builds and functions as normal, however, when the MaskedTextBox is present, the design throws an exception.
Has anyone seen this? I've already submitted to Microsoft as I believe it could be a Visual Studio issue, but I wanted to see if anyone else has stumbled across this issue and found a resolution, or could possibly offer things for me to try.
Upvotes: 1
Views: 992
Reputation: 181
It turns out that the issue was whether or not my DesignInstance was marked as DesignTimeCreateable.
Changing this: d:DataContext="{d:DesignInstance ViewModel:TextServiceHandler}"
To this: d:DataContext="{d:DesignInstance ViewModel:TextServiceHandler, IsDesignTimeCreatable=True}"
Resolved the issue. I didn't need to specify a default value for the bound property. It just seems the Toolkit didn't like the binding when the instance wasn't created during design time. I'll be posting this to the Xceed forums as well.
Upvotes: 0
Reputation: 803
I was seeing this problem with the 2.6.0 version of the Extended.Wpf.Toolkit from NuGet. This is definitely not a Microsoft issue. I was using MVVMLight and was setting some design time data on my viewmodel in the constructor.
Turns out that the data I was setting legitimately did not conform to the mask - my mask was for SSNs (123-45-6789) and the value I was assigning to the bound value was "1234567890" or "123-45-67890". Changing the value in my constructor to match the expected mask length fixed my problem.
Upvotes: 1