Home Forums WPF controls Xceed DataGrid for WPF Set fixed column width (and height)

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

    I’ve found ‘FixedColumnSplitterWidth’ but don’t know how it works.
    Please, how to set equal column width in XAML?

    Imported from legacy forums. Posted by fluxay (had 2654 views)

    User (Old forums)
    Member
    Post count: 23064

    Default cell width is 120 as I see.
    I set the width in code for every datagrid and every column in it like this:

    for (int i = 1; i <= 4; i++)
    dataGridControl1.VisibleColumns[dataGridControl1.VisibleColumns.Count – i].Width = 100;

    for (int i = 1; i <= 4; i++)
    dataGridControl2.VisibleColumns[dataGridControl2.VisibleColumns.Count – i].Width = 55;

    What about XAML? Or could the C# snippet be simple?

    Imported from legacy forums. Posted by fluxay (had 671 views)

    Xceed Support
    Member
    Post count: 5658

    The FixedColumnSplitterWidth property provides the width for the splitter that separates the fixed columns from the non-fixed columns.

    If you want to set the width of all the columns to the same thing, then you could simply do a foreach through the VisibleColumns collection and set their width.

    <code>
    foreach( Column column in myGrid.VisibleColumns)
    {
    column.Width = 100;
    }
    </code>

    In XAML, you will need to define the columns in the DataGridControl.Columns collection and set their width property there (the order in which they are added represents their visible position).

    Imported from legacy forums. Posted by Jenny [Xceed] (had 3647 views)

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