How to add text to the Row Headers

Posted by: ray on 17 March 2023, 6:02 am EST

    • Post Options:
    • Link

    Posted 17 March 2023, 6:02 am EST - Updated 17 March 2023, 6:07 am EST

    Hello. I would like to know how to write into and read from the Row Headers and also the top,left cell (known as 0,0 in the winforms version).

  • Posted 19 March 2023, 8:27 pm EST

    Hi,

    In order to achieve this requirement, you can override BindCellContent method of GridCellfactory as:

            public override void BindCellContent(GridCellType cellType, GridCellRange range, FrameworkElement cellContent)
            {
                base.BindCellContent(cellType, range, cellContent);
                // Row-Header cell
                if (cellType == GridCellType.RowHeader)
                {
                    if (cellContent is TextBlock txt)
                    {
                        txt.Text = range.Row.ToString();
                    }
                }
                // Top-Left cell
                if (cellType == GridCellType.TopLeft)
                {
                    if (cellContent is TextBlock txt)
                    {
                        txt.Text = "0,0";
                        txt.Background = Brushes.Green;
                    }
                }
            }

    Please refer the attached sample for the same: FlexGridRowHeader.zip

    Best Regards,

    Nitin

  • Posted 20 March 2023, 8:03 am EST

    Hi Nithin.

    Thanks for that example. I appreciate your time.

    Honestly I’m very disappointed that I bought this set of controls. Using the Grid is chronically cryptic. I thought being a C1 control that it would have been much like the Windows Forms control, myGrid[0,0] = “Top left”; But in the WPF version I have to override and hack my way into everything. Also none of the binding is there like I imagined it would be.

    I would recommend this control at all. It’s like the Microsoft version with very little extra.

  • Posted 20 March 2023, 4:57 pm EST

    Hi,

    Apologize for the inconvenience.

    WPF FlexGrid and Winforms FlexGrid has built different. They have different architectures and APIs.

    WPF FlexGrid uses GridCellFactory to create, prepare and dispose cells to increase the performance of the flexGrid.

    If you face any issues with the Wpf Flexgrid, then you can get back to us and open a different thread.

    Regards,

    Nitin

Need extra support?

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

Learn More

Forum Channels