WPF data binding

WPF data binding

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

Gravity00 posted on Friday, June 11, 2010



I have a BusinessList Base class 'Roster' which has a factory method "FetchAll". I am databinding this to a listbox using an ObjectDataProvider

<ObjectDataProvider x:Key="roster" ObjectType="bo:Roster"  MethodName="FetchAll"/>


I have a button for deleting an item from the list. In the code behind how do I get access to the object returned from the factory method?

I tried 

_roster = (Roster)(FindResource("roster") as ObjectDataProvider).ObjectInstance;

but it return a emply collection?



RockfordLhotka replied on Friday, June 11, 2010

You should consider using CslaDataProvider, as it understands the static factory method model recommended for CSLA objects. I don't think the ObjectDataProvider works? I know it didn't work originally, though perhaps Microsoft changed something in .NET 3.5.

Even so, the CslaDataProvider includes other CSLA-specific features and functionality that you'll almost certainly find useful.

Copyright (c) Marimer LLC