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
235
Row Data Bound Event Missing
posted

Hi

I am just evaluating several grids for a new product but have run into a problem with the xamDataGrid.

From what I can see there is no RowDataBound (or equivalent) event in the xamDataGrid. I have seen some declaritive examples using triggers etc in the xaml code but I'm not sure that these will be a good approach for me.

I have a situation where I need to be able to update colors and text in the grid rows and cells based on some fairly complex conditional logic. I also need to be able to access the value of any field in the datasource for each row to gain the values needed for this logic. In addition I need to access and modify the value of unbound cells in the row.

In all other grids that I have used this was all easily accessible in the event args of a RowDataBound (or similar) event. I come from a Winforms/ASP.net background so I realise that things may not be that simple but I have seen this kind of event in othe WPF grids.

Apart from that I think that the xamDataGrid would serve my needs very well so I hope that someone can come up with a simple way that I can apply my logic in the C# codebehind.

 

Thanks Alan

Parents
  • 69686
    posted

    Hello Alan,

    The event you are looking is probably InitializeRecord. In this event, the record is created (bound). The DataRecord exposes a DataItem property, which is your underlying business class. It also exposes a Cells collection ( collection of all the cells in the record).

    If you want to perform update on color,text etc on the CellValuePresenter (cells) you can use a converter (IValueConverter). Please follow the link below for an example on how to achieve that:

    http://community.infragistics.com/forums/p/20644/74574.aspx#74574

    You might also find helpful our helper methods Infragistics.Windows.Utilities.GetAncestorFromType/GetDescendantFromType which would help you go up/down the element tree very easily.

    Please let me know if you have any more questions or need further assistance.

Reply Children