CslaDataProvider - WPF Databinding noob question

CslaDataProvider - WPF Databinding noob question

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


decius posted on Thursday, June 04, 2009

I'm new to WPF, but not Csla. I'm a bit confused about the uses of the CslaDataProvider. Is there anyway to databind to the XAML via an object that I fetch through the codebehind???

For example, I already have a constructed object that I pass to my form's constructor.  I don't want the XAML to call the Factory method Fetch because I already have the object. 

I would use a standard ObjectDataProvider, but it requires a default constructor on the class, which breaks Csla convention....

How can this be done?

 

 

shawndewet replied on Thursday, June 04, 2009

Set your fetched csla business object as the datacontext in the constructor of your form:

   Me.DataContext = MyCSLABusinessObject

RockfordLhotka replied on Thursday, June 04, 2009

If you want to use the CslaDataProvider you can set the ObjectInstance property of the data provider from code-behind.

Copyright (c) Marimer LLC