I have a xamlgrid nest down a few levels into a layout grid.
If I set the DataSource of the xamlgrid in code (create the object and then set the source = obj.prop), the grid works. I can't get it to work through xaml, though. I compared my xaml to that in the feature browser, and it sure looks the same to me.
First I create the object containing the data:
<Grid.Resources>
<ObjectDataProvider x:Key="SCRUB" ObjectType="{x:Type data:ScrubData}" />
</Grid.Resources>
Next I assign that object to the xamlgrid:
DataSource="{Binding Source={StaticResource SCRUB}, Path=GetTestData}"
GetTestDate() is the method name that returns the .
Meanwhile this code in the code-behind works:
this.XamDataGridObject.DataSource = App.ScrubData.GetTestData();
Now... data:ScrubData lives in another assembly and is referenced in the xaml as follows:
xmlns:data="clr-namespace:MyNamespace.Data;assembly=MyDll"
ps: this editor drives me nuts.
Can you spot anything missing? Thanks.
Probably if you bind it to a property or dependency property it will work, I guess.
am I correct Joe?
Vairam
Upon further thought, I'm a little confused (shocker).
I need to build additional methods into my data source assembly to retrieve various data sources. Programmtically, I was assigning the result of each method to the corresponding elements.
Is it possible to declare the data source in the resources without a method name, so that i can then bind to it from various elements, specifying the method name seperately for each individual situation? I wouldn't want to create a seperate copy of the same data repository object multiple times in order to retrieve varying result sets from the same base data.
Woo Hoo!
Thanks, Joe!