ComponentOne DataGrid for WPF and Silverlight
C1.WPF.DataGrid Namespace / C1DataGrid Class / ColumnWidth Property

In This Topic
    ColumnWidth Property
    In This Topic
    Gets or sets the column width for all the columns in the C1DataGrid.
    Syntax
    'Declaration
     
    
    Public Property ColumnWidth As DataGridLength
    public DataGridLength ColumnWidth {get; set;}
    Remarks
    DataGridLength supports four different modes
    Type Description
    Pixel The width of the column will be the same as the amount of pixels specified.
    Auto The width of the column will be determined by the content of the cells in the columns.
    Star The viewport space will be divided among the Star and AutoStar columns.
    AutoStar Each column is assured to have enough space to show its content and when extra space is available it is divided among the Star and AutoStar columns.

    If a column has the property Width set, the layout will take the value set in the column over the one in the data grid.

    Notice MinColumnWidth and MaxColumnWidth has precedence over this property, that mean that if you set ColumnWidth=100 and MinColumnWidth=110 the actual value will be 110.

    If you want to know the actual width in pixels of an auto-width column you should query DataGridColumn.ActualWidth.

    See Also