FlexGrid.4.5.2 Row Details

Posted by: rdbrownii on 22 January 2022, 5:37 am EST

  • Posted 22 January 2022, 5:37 am EST

    How I can determine when a Detail Row is being loaded/made visible in C1FlexGrid for WPF v4.5.2. I can’t find any event similar to C1DataGrid’s LoadedRowDetailsPresenter event. I can see how to do this in the .NET 5/6 version of FlexGrid, but not the 4.5.2 version.

  • Posted 26 January 2022, 2:47 pm EST

    Hi,

    Please note, there is no direct way in C1FlexGrid to know about the details row loading . However, you can use a specific workaround based on the requirement using PreviewMouseLeftButtonUp event as shown below.

    private void Grid_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
       {
           Point p = e.GetPosition(grid);
           HitTestInfo hittest = grid.HitTest(p);
           if (hittest.CellType == CellType.RowHeader && grid.Rows[hittest.Row + 1].IsVisible == true)
           {
               var panel = hittest.Panel.GetCellRect(hittest.CellRange);
               var ele = grid.InputHitTest(new Point() { X = panel.Width + 10, Y = grid.ColumnHeaders.ActualHeight + panel.Bottom + 10 });
               if (ele is TextBlock && (ele as TextBlock).Parent is Grid)
               {
                   Grid sp = (ele as TextBlock).Parent as Grid;
                   MessageBox.Show("Main Row Index = " + hittest.Row + "\n Detail Row Index = " + (hittest.Row + 1) + "\n\n" + (sp.Children[0] as TextBlock).Text + (sp.Children[1] as TextBlock).Text + "\n" + (sp.Children[2] as TextBlock).Text + (sp.Children[3] as TextBlock).Text);
               }
           }
       }
    
    

    Note: implementation is specific to use case there is no guaranteed to work for all time.

    We have also attached the sample for your reference FlexGrid__1_.zip.

    Regards,

    FlexGrid__1_.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels