Flexgrid lock columns

Posted by: kisar on 21 February 2020, 4:20 am EST

    • Post Options:
    • Link

    Posted 21 February 2020, 4:20 am EST

    Hi

    is it possible lock some columns so in case I have many columns

    I will see only the locked and the “unlocked” will be visible using the horizontal ScrollBar

    thanx

  • Posted 23 February 2020, 5:29 pm EST - Updated 3 October 2022, 11:38 pm EST

    Hi,

    You can specify the number of columns to be frozen/locked as follows:

    flexGrid.FrozenColumns = 2;
    
    

    Also, FlexGrid now allows freezing columns/rows from UI by using AllowFreezing property as follows:

    flexGrid.AllowFreezing = AllowFreezing.Columns;
    

    For more information regarding Freezing visit https://www.grapecity.com/componentone/docs/wpf/online-flexgrid/freezing_pinning.html.

    Regard,

    Basant

  • Posted 23 February 2020, 7:31 pm EST

    hi,

    thank you, I have a more question,

    suppose I want to force a column to be not immediately visible,

    I mean that I must be “on the right”, so I need to use the horizontal scrollbar to view it.

    I tried with frozencolumn but, maybe because in this case ther’are few columns, it is visible as the others.

    How can I achieve that?

    Thanx

  • Posted 23 February 2020, 10:30 pm EST

    Hi,

    FrozenColumn keeps the specified number of columns frozen(fixed) even if you scroll. So, for your requirement, it would require to let the frozen columns span to the width of the grid. However, in that case, there would be no space left to display remaining(unfrozen) columns.

    So, it seems infeasible to implement the specified requirement. Please correct me, just in case I misinterpreted something.

    Regards,

    Basant

  • Posted 23 February 2020, 10:42 pm EST

    If I have 5 columns, 2 of that I want “on the right”.

    I could froze 2, so the third would be visible at the begin

    and using the horizontal scrollbar I could view 4 e 5 scolling on the 3°.

    But can I set the flexgrid so that at the begin I can see only 1,2,3 ?

    I tried with this configuration (frozen=2):

    1° Width=100

    2° Width=100

    3° Width=1*

    4° Width=100

    5° Width=100

    but because ther’s space I see all of them

    Thanx

  • Posted 24 February 2020, 5:53 pm EST

    Hi,

    Columns of * width take the remaining space available in the current view. So, Instead of * or 100 pixels fix width, we have to divide the currently available space in view(i.e. ~ width of the grid) into the number of columns to be displayed (e.g. 3 in your case).

    So, the width for each column can be assigned as follows:

    double flexGridRowWidth = flexGrid.Width - flexGrid.RowHeaders.ActualWidth;
    for (int columnIndex = 0; columnIndex < flexGrid.Columns.Count; columnIndex++)
    {
        flexGrid.Columns[columnIndex].Width = new GridLength(flexGridRowWidth / (flexGrid.FrozenColumns + 1));
    }
    
    

    The above settings can be specified in FlexGrid.Loaded or Window.SizeChanged(if you always want to display frozen columns + one additional column) whichever you prefer.

    Regards,

    Basant

  • Posted 19 October 2021, 10:41 am EST

    Hi,

    I’m looking to implement this on the .NET5 version of the FlexGrid, but I can’t seem to find the property on the grid.

    Has this functionality been implemented for the the .NET5 version?

    Thanks,

    Felix

  • Posted 19 October 2021, 4:35 pm EST

    Hello,

    You can freeze columns and rows in Flexgrid .Net 5. For that you need to set FrozenColumns and FrozenRows property of Flexgrid. (see code snippet)

    
    <c1:FlexGrid x:Name="grid" FrozenColumns="1" FrozenRows="2" FrozenLinesBrush="Black"/>
    
    

    Please refer the attached sample for the same : FlexgridFrozenRowsColumns.zip

    Regards,

    Nitin

  • Posted 20 October 2021, 12:49 am EST

    Hi Nitin,

    Thanks for the reply.

    I’m really asking about the AllowFreezing property that allows the user to interactively freeze columns in the UI.

    Thanks,

    Felix

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels