We have just migrated an old Silverlight 4 app to Silverlight 5 and have noticed a problem with one of our Dataforms. The Dataform in question contains a NumericUpDown control from the SL5 toolkit. We have noticed that the CommitEdit doesn't appear to fire (i.e it returns false) in the following scenario:
1) Open the popup window containing the DataForm
2) Change the value in the NumericUpDown control by either clicking on the up or down arrows.
3) Click on the Save button connected to the Dataform.
The Click event code connected to the Save button is as follows:
private void OKButton_Click(object sender, RoutedEventArgs e)
{
if (updateUserDataForm.ValidateItem())
updateUserDataForm.CommitEdit(true);
else
updateUserDataForm.CancelEdit();
}
The XAML is:
<toolkit:DataField Label="Display Order" LabelStyle="{StaticResource LabelStyles}" HorizontalAlignment="Left">
<toolkit:NumericUpDown Minimum="1" Maximum="200" Value="{Binding DisplayOrder, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ValueChanged="NumericUpDown_ValueChanged"/>
</toolkit:DataField>
The CommitEdit works fine when you first give another control on the form focus before clicking on the Save button. We never had this behaviour when we were using the DatForm and NumericUpDown controls from the SL 4 toolkit. Is this an issue that has been introduced with the SL5 toolkit?
OK it appears that this is actually a bug:
http://forums.silverlight.net/t/182569.aspx/1
I have fixed it by extending the NumericUpDown control as described here:
http://silverlight.codeplex.com/workitem/4633
I'm sure this must be a bug specific to the SL5 toolkit.