ASP.NET MVC Controls | ComponentOne
Working with Controls / FlexGrid / Work with FlexGrid / Star Sizing
In This Topic
    Star Sizing
    In This Topic

    You can use XAML-style star sizing to implement flexible layouts with the FlexGrid. The sample below uses Star sizing specified in the width property of the object.

    This grid has three columns. The first is 80 pixels wide and can be resized between 40 and 160 pixels. The other two have widths of 2* and *, and cannot be resized using the mouse. The width proportions of the columns remain unchanged even on resizing the first column or the whole grid.

    The following image shows how the FlexGrid appears on applying star sizing on the columns using the Width property. The example uses Sale.cs model added in the QuickStart section.

    The following code examples demonstrate how to apply star sizing to the columns of the FlexGrid:

    In Code


    Copy Code
    public ActionResult StarSizing()
        return View(Sales.GetData(10));


    Copy Code
    @using MVCFlexGrid.Models
    @using C1.Web.Mvc.Grid
    @model IEnumerable<Sale>
        .Columns(columns =>
            columns.Add(column => column.Binding("Start").Width("80").MaxWidth(160).MinWidth(40));
            columns.Add(column => column.Binding("Product").Width("2*").AllowResizing(false));
            columns.Add(column => column.Binding("Country").Format("c") .Width("*"));
    See Also