Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
XamWebGrid, ObservableCollection of custom DynamicObjects -> key(s) do not correspond with the DataSource
posted

Normal 0 false false false EN-US X-NONE X-NONE

Dear SL Forum

We have an ObservableCollection of customer classes of type System.Dynamic

 .DynamicObject s that have some class properties as well as a GetPropertyValue method.   In debug mode, at just prior to assigning my ObservableCollection to myxamWebGrid.ItemsSource I can validate my collection:

 

((MyDynamicObject)(myObservableCollectionOfMyDynamicObject [0])).GetPropertyValue("myPropertyName")

 

and get a valid result in my QuickWatch view.

 

However, upon assigning  myxamWebGrid.ItemsSource = myObservableCollectionOfMyDynamicObject

I get:

 

The following key(s) do not correspond with the DataSource: "myPropertyName ". If you'd like to add additional columns, please use the UnboundColumn type.

 

The xamWebgrid’s columns are created at runtime, where each column is an Infragistics.Silverlight.Controls.TextColumn

The HeaderText and Key properties for each TextColumn is assign a value.   The Key property is assigned a value that matches the appropriate value for the  ((MyDynamicObject)(myObservableCollectionOfMyDynamicObject [0])).GetPropertyValue method parameter, e.g. ‘myPropertyName’ going with my example above.

 

I believe the issue is that my assumption that the TextColumn key value will be passed to the GetPropertyValue was incorrect, but confirmation would be nice.

 

What would be a better approach to achieve my goal binding an xamWebGrid to an ObservableCollection of custom DymamicObjects.

 

Thank you in advance.

Parents
No Data
Reply Children
No Data