ComponentOne FlexGrid for UWP
Features / Freezing and Pinning
In This Topic
    Freezing and Pinning
    In This Topic

    Freezing Rows and Columns

    This feature in UWP FlexGrid allows you to freeze the rows and columns using mouse drag during runtime following a particular sequence. You can set the AllowFreezing Enum to Columns to freeze only columns, Rows to freeze only rows, or Both to freeze both columns and rows. Conversely, to disable freezing, set the AllowFreezing Enum to None, which is the default setting. This property can be set either in the designer or in code.

    In Designer

    Locate the AllowFreezing Enum in the Properties window and set it to Rows, Columns, Both or None.

    In Code

    Add the following code to set the AllowFreezing Enum to Both:

    c1.FlexGrid.AllowFreezing = C1.WPF.FlexGrid.AllowFreezing.Both

    Now, you can manually use the mouse drag to adjust the number of frozen columns and rows as needed. When the mouse pointer becomes the lock rows or the lock columns icon, click and drag the mouse over the rows or columns to freeze in a sequence.

    Column Pinning

    Column Pinning in UWP FlexGrid allows the you to freeze any column in the grid and pin it to the start, this will allow you to see it while horizontally scrolling the Grid. A column or multiple columns can be pinned to the left-hand side of the FlexGrid.

    Each column can be pinned, as long as the pinned area does not become wider than the Grid itself. Pinned columns are always rendered on the left side of the Grid and stay fixed through horizontal scrolling of the unpinned columns in the Grid body.

    Use the following code to implement Column Pinning in your FlexGrid application through ColumnPinningCellFactory class which is a customized CellFactory class that will add a pinning icon to each column header.

    private void GridColumnPinning_Loaded(object sender, RoutedEventArgs e)
                grid.CellFactory = new ColumnPinningCellFactory();

    Note: ColumnPinning is not a part of the control, it is only available as a code sample. You can find the complete source code of ColumnPinningCellFactory in the ColumnPinning sample available at following location:

    Documents\ComponentOne Samples\UWP\C1.UWP.FlexGrid\CS\ColumnPinning