Home Forums WinForms controls Xceed Grid for WinForms Triggering SiblingValueChanged

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

    Hi,

    I read in another thread that the Grid.Refresh method would trigger the SiblingValueChanged event, but it doesn’t seem to work for me. It’ll pop up when i assign a datasource or when i modify cell values, but i can’t seem to refresh the whole grid without having to rebind.

    What i want to do is lock most of the grid’s cells when an outside checkbox is checked and unlock them when it is unchecked (with a few exceptions). Best way to do it would be to have an event triggered for each cell.

    Thanks.

    Imported from legacy forums. Posted by JP Lambert (had 2465 views)

    Xceed Support
    Member
    Post count: 5658

    You can could simply loop through the Cells of the DataRowTemplate to set most of the cells and them modify the exceptions.

    Here is a rough example of what I had in mind:

    e.g.,
    <code>
    private void Form1_Load( object sender, EventArgs e )
    {
    for( int j = 0; j < 6; j++ )
    {
    Column col = new Column( “Column”+j.ToString() );
    gridControl1.Columns.Add( col );
    }

    for( int i = 0; i < 50; i++ )
    {
    Xceed.Grid.DataRow row = gridControl1.DataRows.AddNew();
    foreach( Cell cell in row.Cells )
    {
    cell.Value = “Item ” + i.ToString();
    }
    row.EndEdit();
    }
    }

    //The event from the “lock” checkbox
    private void checkLock_CheckedChanged( object sender, EventArgs e )
    {
    if( checkLock.Checked )
    {
    foreach( Cell cell in dataRowTemplate1.Cells )
    {
    cell.ReadOnly = true;
    }
    //Handle the exceptions here
    }
    else
    {
    foreach( Cell cell in dataRowTemplate1.Cells )
    {
    cell.ReadOnly = false;
    }
    //Handle the exceptions here
    }
    }
    </code>

    Imported from legacy forums. Posted by CharlesB (had 205 views)

    User (Old forums)
    Member
    Post count: 23064

    I guess i was overthinking this one…lol

    Made a simple loop that calls the SiblingValueChanged handler for each cell…works like a charm! Thanks.

    Private Sub grdEfforts_Refresh()

    Dim gCell As Xceed.Grid.Cell
    Dim gRow As Xceed.Grid.DataRow

    For Each gRow In grdEfforts.DataRows
    For Each gCell In gRow.Cells
    grdEfforts_SetCellStyle(gCell, New System.EventArgs())
    Next
    Next

    End Sub

    Imported from legacy forums. Posted by JP Lambert (had 3647 views)

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