Home Forums WinForms controls Xceed Grid for WinForms May I add a label or button column as sepator?

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

    May I add a label or button column as sepator?

    My grid lists several columns, and clearly display the column features, I need add a label column or button column or a wide separator as column separator to divide several set columns.

    Imported from legacy forums. Posted by aixllxia (had 3054 views)

    User (Old forums)
    Member
    Post count: 23064

    You can add an unbound column, in the designer or from code, like this:<code>Column colSeparator = new Column();
    grid.Columns.Insert(col1.Index, colSeparator); // insert the column before column <i>col1</i></code>I think it’s a good idea to set some properties that make sure the separator column doesn’t do much, and isn’t too interactive:<code>colSeparator.CanBeGrouped = false;
    colSeparator.CanBeSorted = false;
    colSeparator.Width = width;
    colSeparator.MinWidth = width;
    colSeparator.MaxWidth = width;
    colSeparator.Title = “”;</code>

    Imported from legacy forums. Posted by Tommy (had 444 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m trying the above mentioned code but I’ getting a System.InvalidOperation Exception “An attempt was made to add an uninitialized column to a ColumnList”

    here’s my code:
    Xceed.Grid.Column colSeparator = new Xceed.Grid.Column();
    colSeparator.CanBeGrouped = false;
    colSeparator.CanBeSorted = false;
    colSeparator.Width = 22;
    colSeparator.MinWidth = 12;
    colSeparator.MaxWidth = 22;
    colSeparator.Title = ” “;
    DFGrid.Columns.Insert(1, colSeparator);

    TIA

    Imported from legacy forums. Posted by beny (had 316 views)

    User (Old forums)
    Member
    Post count: 23064

    Apparently, the Column must be initialized (have a name and type) before you can add it to the grid. To fix this, just change the first line to something like this:<code>Xceed.Grid.Column colSeparator = new Xceed.Grid.Column(“colSeparator”, typeof(string));</code>

    Imported from legacy forums. Posted by Tommy (had 4062 views)

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