How do I bind a Field to a lower XPath element that the default? For instance, I have XML with a structure similar to this
<Family> <Persons> <Person> <FirstName>Bob</FirstName> <LastName>Smith</LastName> <Friends> <Friend> <FriendName>Ralph</FriendName> <FriendAge>22</FriendAge> </Friend> </Friends> </Person .etc .etc </Persons></Family>
In the XAML, I have a DataProvider, e.g.<XmlDataProvider x:Key="FamilyData" XPath="/Family" Source="Family.xml"/>
and a grid bound to it, e.g.<igDP:XamDataGrid x:Name="_xamDataGrid" DataSource="{Binding Source={StaticResource FamilyData}, XPath=//Person}">
Fields are defined, e.g.<igDP:Field Name="FirstName" Label="First Name"/><igDP:Field Name="LastName" Label="Last Name"/><igDP:Field Name="???" Label="Friend"/>
I want the third Field bound to the relative XPath Friends/Friend/FriendName. How do I do this?
Thanks.Greg
Thanks, Joe. A couple other questions,
What is BindingPath relative to? The DataSource binding of the DataGrid? Do need a full XPath?
Since this UnboundField is now bound, I assume that I do not need to assign a value in my grid's InitializeRecord method. Correct?
So far I haven't put together the right settings to display this field. The sample app does not use BindingPath and the doc example has no context so "BindingPath="City"" isn't very helpful. Thanks.
Thanks, Joe. Can you give me a for instance for my example above?
I have tried BindingPaths like this but nothing seems to work...
<igDP:UnboundField Name="FriendName" Label="Friend Name" BindingPath="Friends/Friend"/>
Thanks.