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
205
Styling Hierachical Grid Column Headers
posted

Hi!  I am using the XamGrid to create a hierarchical grid.  Under each record of the main grid is another grid of data for drill-down purposes.

The problem I am having is that I want the sub-grid headers to have a different color from the main grid.  I can set a style in the XAML and the apply that style to the grid FieldSettings.LabelPresenterStyle, but that sets the header color for all header labels:

 

foreach (Infragistics.Windows.DataPresenter.FieldLayout field in dataResults.FieldLayouts)
                {
                    if (field.Description != "Company")
                    {
                        Style newHeaderColor = (Style)dataResults.FindResource("changeHeaderColor");
                        dataResults.FieldSettings.LabelPresenterStyle = newHeaderColor;
                    }
                }

I would like to have the sub-grid headers have a different color.  How might I achieve this?  Thanks!

Parents
No Data
Reply
  • 9836
    Verified Answer
    posted

    In the foreach cycle you just set the LabelPresenterStyle for all of the fields rather individually. You can modify your code as follows in order to set this style to the Company field:

    foreach (Infragistics.Windows.DataPresenter.FieldLayout field in dataResults.FieldLayouts)
                    {
                        if (field.Description != "Company")
                        {
                            Style newHeaderColor = (Style)dataResults.FindResource("changeHeaderColor");
                            field.FieldSettings.LabelPresenterStyle = newHeaderColor;
                        }
                    }

    Let me know if this will resolve the issue.

Children