Silverlight 5 Datagrid/BusinessListBase

Silverlight 5 Datagrid/BusinessListBase

Old forum URL:

MadGerbil posted on Tuesday, January 15, 2013


Does anyone have an example of a business list base attached to a Silverlight Datagrid where you can get 'Excel' like behavior.   Currently when I attach a business list base to a datagrid a few undesirable things happen:

1: If I select an item down in the list and change a field upon exiting the field the focus (selected item) gets reset to the first item in the list.

2: If a row contains an error I'm locked onto that row until the error is fixed.

3: I'd like a red box around each error on the 'spreadsheet'.

I'm using the examples in the CSLA books in that I'm using MVVM and Object and a ObjectInfo where Object is the model for the viewmodel and ObjectInfo is the viewmodel for each row in the datagrid.  I've the following in my XAML:

 <CollectionViewSource x:Key="viewModel"/>

<CollectionViewSource x:Key="list" Source="{Binding Path=ItemList, Source={StaticResource viewModel}}"/>

This works in that my datagrid is bound to 'list' and the items are displayed (errors show up nicely) but when I select between the different rows I get the focus jumping around IF I make a change to a textbox (and leave at least one error in place) and the row will lock.

Perhaps I have to make it so a child window opens when a row is selected (I have that working nicely) but I'd rather have this very simple data be displayed and work like an Excel spreadsheet.   Any example of something like that working with MVVM would be great.

Copyright (c) Marimer LLC