Home Forums WinForms controls Xceed Grid for WinForms Showing RadioButton in Particular Column

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

    Hi All,

    I want to show the RadioButtons in a particular column in the GridControl.

    If I want to select any one Radiobutton with in the row all RadioButtons is selecting.

    I want to implement the fuctionality to select at a time one RadioButton in the Column.

    How can I implement this functionality.

    Regard
    Swamy

    Imported from legacy forums. Posted by swamysoft@gmail.com (had 2025 views)

    User (Old forums)
    Member
    Post count: 23064

    Andre answered you through support, here is the answer again 🙂

    You need to use the CellEditorManager class, and rap a RadioButton through it, and it should work fine :

    private void Form1_Load(object sender, System.EventArgs e)
    {
    //gridControl1.SingleClickEdit = true;

    RadioButton radio = new RadioButton();
    radio.AutoCheck = false;

    gridControl1.Columns[ 0 ].CellEditorManager = new Xceed.Grid.Editors.CellEditorManager( radio, “Checked”, true, true );
    gridControl1.Columns[ 0 ].CellViewerManager = new CellViewerManager( radio, “Checked” );

    gridControl1.Columns[ 0 ].CellEditorManager.ActivatingControl += new CellEditorEventHandler(CellEditorManager_ActivatingControl);
    gridControl1.Columns[ 0 ].CellEditorManager.DeactivatingControl += new CellEditorEventHandler(CellEditorManager_DeactivatingControl);

    for( int i = 0; i < 5; i++ )
    {
    Xceed.Grid.DataRow row = gridControl1.DataRows.AddNew();
    row.EndEdit();
    }
    }

    private void CellEditorManager_ActivatingControl(object sender, CellEditorEventArgs e)
    {
    System.Diagnostics.Debug.WriteLine( “in activating” );
    ( ( RadioButton )e.Control).Click += new EventHandler(Form1_Click);
    }

    private void CellEditorManager_DeactivatingControl(object sender, CellEditorEventArgs e)
    {
    System.Diagnostics.Debug.WriteLine( “in deactivating” );
    ( ( RadioButton )e.Control).Click -= new EventHandler(Form1_Click);
    }

    private void Form1_Click(object sender, EventArgs e)
    {
    System.Diagnostics.Debug.WriteLine( sender.ToString() );
    ( ( RadioButton )sender).Checked = !( ( RadioButton )sender).Checked;
    }

    Imported from legacy forums. Posted by Matt (had 2985 views)

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