FlexGrid - get cell value after modifying in BindCellContent

Posted by: jared.fritsch on 14 November 2017, 4:36 am EST

    • Post Options:
    • Link

    Posted 14 November 2017, 4:36 am EST

    I have a bound FlexGrid with a few columns that I would like to be unbound, where I manually set the value. Using the GridCellFactory’s “BindCellContent” method, I can set the value quite easily.

    public override void BindCellContent(GridCellType cellType, GridCellRange range, View cellContent)
    {
        base.BindCellContent(cellType, range, cellContent);
    
        if (cellType == GridCellType.Cell)
        {
            if (cellContent is Label label)
            {
                label.Text = "Test";
            }
        }
    }
    

    However, I cannot figure out how to retrieve that value I set. “GetCellText” and “GetCellValue” get me the bound value of the cell. So if I set a binding on the column, I get back that original value. If I don’t set a binding on the column, I get the entire data item. I would expect this line to get me back the string “Test”.

    var text = MyGrid.GetCellText(cellRange);
    
  • Posted 21 November 2017, 8:47 pm EST

    Hi Jared,

    I was able to reproduce the same behavior. This seems to be an issue. It appears that the grid is treating the unbound column as a bounded entity and hence the observed behavior.

    I’ve escalated this to the concerned team and would inform you as soon as there’s an update on this.[Internal Tracking Id: 298274]

    Regards,

    Ankit

  • Posted 22 November 2017, 1:38 am EST

    Thanks, Ankit!

  • Posted 2 April 2018, 7:12 pm EST

    Hi Jared,

    There’s an update from our development team on this. As per their suggestion it is recommneded to override GetCellText in a customized GridColumn in order to get the desired behavior. Attached is a modified code from the FlexGrid101 ConditionalFormatting sample that demonstrates the same.

    Hope it helps.

    Regards,

    Ankit

    ConditionalFormatting.xaml.zip

Need extra support?

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

Learn More

Forum Channels