Silverlight Datagrid & Binding to Business List Base

Silverlight Datagrid & Binding to Business List Base

Old forum URL: forums.lhotka.net/forums/t/10608.aspx


MadGerbil posted on Thursday, August 11, 2011

Greetings:

I'd like to see an example of binding to a BusinessListBase (without BXF) in such a way that a new record is created at the end of the list.  I can bind a collection in Silverlight, retrieve items across the dataportal and display them, but I'm not aware of how to have items added via AddNewCore which was a comon practice of mine in Windows Forms.

Do we have to use a "Add" button in Silverlight (I see that in the MVVM video) or is the "AddNewCore" available in Silverlight and if so is there an example code that shows client/server code for the BusinessListBase anywhere?

Thanks

RockfordLhotka replied on Thursday, August 11, 2011

You need an add button or link or something similar. The new XAML-based data binding interfaces don't define any add-new concept, so there's nothing built into the datagrid to do that operation.

The ViewModelBase and ViewModel classes have a method to do this, so all you need to do is bind your UI element (button or whatever) to that method - but sadly you do need to do it yourself.

MadGerbil replied on Friday, August 12, 2011

Oh, I saw the thread discussing the failing of the datagrid in WPF but I thought Silverlight had avoided that pitfall.   It really is a slick feature to have rows added automagically at the end.   Thank you for communicating this need to the WPF team, I look forward to them releasing an improved version of the datagrid one day.

I've the add button working and I'll go on and put in a delete button as well.

Oh sigh...  Stick out tongue

Copyright (c) Marimer LLC