Hi, I am using a SL XamGrid with a TemplateColumn.
In the template column ItemTemplate is a XamNumericEditor.
I need to set the Mask of the XamNumericEditor so it can be different for each row of the grid.
I have databound the XamNumericEditor Mask property to a property that exists in each record of my data source.
It all works fine the first time the grid is loaded, however if the data is refreshed I get an exception along the lines of "the mask must be '{double:-i.f}' - which it is as it worked the first time.
I am wondering if this is because the same XamNumericEditor is used for all rows in the column and the mask can only be set once per column?
Maybe I could set the mask in the 'Loaded' event of the XamNumericEditor - if I do that how do I figure out which row of the grid I am in (inside the event handler) so I can go and get the correct mask?
Any help greatly appreciated.
Regards David.
HI,
I am attaching a smaple application that binds the Mask to a property in the object.
Sincerely,
Matt DSE
Hi Matt,
Thanks for the reply.
There is still a problem. Yes, it works the first time the form is loaded. But try removing the last item from the list.
Add a button to the from to remove the last item in the list -
(in MainPage.xaml.cs)
private void Button_Click(object sender, RoutedEventArgs e)
{
var mvvm = LayoutRoot.DataContext as MVVM.MYMVVM;
mvvm.RemoveLast();
}
(in MYMVVM.cs)
public void RemoveLast()
People.RemoveAt(0);
This should work with an ObservableCollection, right?
Now click the button and see how it crashes with the message about illegal mask.
Remove the binding to the mask in the xaml, and everything works.
If I haven't explained this clearly I could send you the code that crashes.
Regards, David.
Thanks Matt.
Any ideas for a workaround?
I need this for the project I am currently working on.
I replicated your issue and will bring it to the attention of the developers.