Welcome to the Xceed Community | Help
Community Search  
More Search Options

Accessing the parent container row in a DataGrid hierarchy (Master/Detail)

Sort Posts: Previous Next
  •  04-15-2009, 6:32 AM Post no. 20228

    Accessing the parent container row in a DataGrid hierarchy (Master/Detail)

    I have a wpf datagrid with a master/detail defined. I have a control in the grid and it needs to know the a value from the current row (I can get this ok) but it also needs the container row to make a calculation.

    Bit like an "Order/Order Detail" where the price calculation on the order detail requires the order type from the header.

     I override the CommittingNewItem, CreatingNewItem because I could not get the automatic stuff to work.Problem is that I can't see a way to get to the parent container row.

    Is there some way I can do this?

  •  04-15-2009, 8:52 AM Post no. 20233 in reply to 20228

    Re: Accessing the parent container row in a DataGrid hierarchy (Master/Detail)

    You can retrieve the row's DataGridContext and the get the parent item through the ParentItem property. If you want the container, then you can call the GetContainerFromItem method to retrieve it.
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  04-15-2009, 6:08 PM Post no. 20286 in reply to 20233

    Re: Accessing the parent container row in a DataGrid hierarchy (Master/Detail)

    Does that work on the insertion row as well?
  •  04-16-2009, 9:58 AM Post no. 20307 in reply to 20286

    Re: Accessing the parent container row in a DataGrid hierarchy (Master/Detail)

    It should. Have you encountered any issues?
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.