views:

105

answers:

0

Hi all,

I have a Silverlight 4 application using a master/detail type UI arrangement. There is a Silverlight 4 datagrid control bound to an ObservableCollection<T> property of a custom ViewModel class I have created.

Below the grid is a detail section that shows the individual detail information for each row of the grid.

Each of the silverlight controls in my detail section is bound with xaml that looks something like this:

<TextBox x:Name="uxAppNameDetail" Grid.Column="1" DataContext="{Binding ElementName=applicationDataGrid, Path=SelectedItem, Mode=TwoWay}" Text="{Binding Path=ApplicationName, Mode=TwoWay}" />

The DataContext of each control in the detail section points back to the selected item of the Silverlight datagrid control, applicationDataGrid.

This part of the databinding is working perfectly. If i make a change in either the editable datagrid control OR in the detail form that points to that selected row of the grid, everything gets updated the way it should.

However now I want to add DataAnnotations data validation to the details section so that you must enter various detail information in the correct format appropriate for my application.

In my custom view model class, I tried creating a public property called 'ApplicationName'. But the setter for that property never gets fired when you make a change to this control. If I can't trigger the setter getting fired after a control value change, I'll never be able to get the DataAnnotations validator to fire properly.

I'm sure there's something either in my xaml or my custom view model i'm not properly databinding correctly.

If anyone has come across the same situation and a solution, please let me know.

thanks in advance, John