Home Forums WPF controls Xceed DataGrid for WPF Configure Grid to bind to nested properties?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24561 |

    So I have a Window with a DataContext that is assigned to a CollectionView of
    Customers. There are various controls that are bound to the properties of the
    CollectionView.CurrentItem (which is a customer). Since each customer can
    have multiple addresses (similar to MS AdventureWorks sample) I implemented a detail panel to display the addresses
    using the standard ListView (Note the nested binding):

    <TabItem Header=”Addresses List”>
    <ListView ItemsSource=”{Binding Path=CustomerAddresses}” >
    <ListView.View>
    <GridView.Columns>
    <GridViewColumn
    Header=”Address Type”
    DisplayMemberBinding=”{Binding Path=AddressType}” />
    <GridViewColumn
    Header=”Address1″
    DisplayMemberBinding=”{Binding Path=Address.AddressLine1}” />
    </GridView.Columns>
    </GridView>
    </ListView.View>
    </ListView>
    </TabItem>

    This works just fine. But of course the ListView does not support editing so I try to use xceed grid. But I can’t figure out how to use it in “stupid” mode where I define each column along with it’s nested binding. Is there a simple sample somewhere that I missed? Help!

    Imported from legacy forums. Posted by David (had 461 views)

    User (Old forums)
    Member
    Post count: 23064

    Tried to do this using DataGridCollectionViewSource and had no success. Then tried directly configuring the DataGridControl.Columns and it worked great:

    <TabItem Header=”Addresses Xceed Grid”>
    <Grid>
    <xcdg:DataGridControl
    ItemsSource=”{Binding Path=CustomerAddresses}”
    AutoCreateColumns=”False” >
    <xcdg:DataGridControl.Columns>
    <xcdg:Column
    FieldName=”AddressType”
    Title=”Address Type”
    DisplayMemberBinding=”{Binding Path=AddressType}” />
    <xcdg:Column
    FieldName=”AddressLine1″
    Title=”Address1″
    DisplayMemberBinding=”{Binding Path=Address.AddressLine1}” />
    </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>
    </Grid>
    </TabItem>

    Imported from legacy forums. Posted by David (had 2694 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.