Home Forums WPF controls Xceed DataGrid for WPF Cell Edit Dynamically

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22664 |

    Hi,

    how can i make a cell editable dynamically.

    by giving row and column indexes.

    Imported from legacy forums. Posted by rajendernag (had 3202 views)

    Xceed Support
    Member
    Post count: 5658

    This is rather complicated due to UI Virtualization. Effectivelly, not all data items from your data source have attached “DataRows”…

    However, if you are always 100% sure that the item you want to dynamically make “editable” is “realized” ( DataRow created for the DataItem):

    <code>
    Row myDataRow = dataGridControl.ItemContainerGenerator.ContainerFromItem( dataGridControl.Items[ myRowIndex ] ) as Row;

    if( row != nulll)
    {
    Cell myCell = myDataRow.Cells[ myColumnIndex ];

    if( myCell != null)
    {
    myCell.ReadOnly = false;
    }
    }
    </code>

    Note: the DisplayMemberBinding for the Column <b>has</b> to be TwoWay for this to work!

    Imported from legacy forums. Posted by Marcus [Xceed] (had 347 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you marcus.

    I tried with this, the row is seleted, but the cell is not into the Edit Mode.

    Imported from legacy forums. Posted by rajendernag (had 578 views)

    Xceed Support
    Member
    Post count: 5658

    Do you want to make the Cell “editable” or place it in edition?

    if it’s the later, then call cell.BeginEdit() instead of cell.ReadOnly = false.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 3850 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.