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
320
Accessing value of a GroupBy Header
posted

Hi,

I have a WinGrid where I have a Groupby Header (see picture below).

Is it possible when clicking on one row to retrieve the value of the grouped by column (in the sample the "Donnerstag, 28.. Oktober 2010")?

Thanks in advance if anybody has an idea.

Regards,

Oliver

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Do you really want the value only when the user clicks on the row? What if they activate the row using the keyboard?

    If you only care about clicking, then using MouseDown as Danko suggested is a good way to go. If you just want to track when the ActiveRow changes, I would do it like this:


            private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
            {
                UltraGrid grid = (UltraGrid)sender;
                if (grid.ActiveRow != null && grid.ActiveRow.IsGroupByRow)
                {
                    UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)grid.ActiveRow;
                    Debug.WriteLine((groupByRow.Value);
                }
            }

    Either way, you get the value by casting the row into an UltraGridGroupByRow and then using the Value property.

Children