Home Forums WinForms controls Xceed Grid for WinForms Combine hidden and multiple fixed columns

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

    Hi all,

    I’ve two serious problems with my xceed grid 2.2: I need to hide columns and I need to freeze columns (not necessarily the leftmost columns. The users should be able to fix also columns in the middle of the screen or rightmost). It’s not a problem to hide one or more columns, but problems then appear with fixing (freezing) columns. First you have to check whether columns are visible as .VisibleIndex does not seem to return the correct ‘visible’ index as even invisible columns are counted. But that’s not a problem.

    The main problem is to fix 2 or more columns. I cannot figure out how the grid computes the new visible index, this is totally strange to me. I tried to understand the example in the helpfile, unfortunately with no success. Especially the way the grid computes the indexes when called in between BeginInit and EndInit confuses me…. 🙁

    It’s very important that the application can handle hidden columns and multiple fixed columns.

    [Visual Basic]
    ‘ Let’s assume that the following columns start in the following
    ‘ visible positions

    gridControl1.Columns( 0 ).VisibleIndex = 0
    gridControl1.Columns( 1 ).VisibleIndex = 1
    gridControl1.Columns( 2 ).VisibleIndex = 2
    gridControl1.Columns( 3 ).VisibleIndex = 3

    ‘ Set the visible position of the 1st and
    ‘ second columns between calls to the BeginInit
    ‘ and EndInit methods

    gridControl1.BeginInit()
    gridControl1.Columns( 0 ).VisibleIndex = 2
    gridControl1.Columns( 1 ).VisibleIndex = 3
    gridControl1.EndInit()

    ‘ As a result, the columns would then possess
    ‘ the following visible positions.

    gridControl1.Columns( 0 ).VisibleIndex = 0
    gridControl1.Columns( 1 ).VisibleIndex = 2
    gridControl1.Columns( 2 ).VisibleIndex = 1
    gridControl1.Columns( 3 ).VisibleIndex = 3

    ‘ If the visible positions of the columns would
    ‘ have been changed outside of calls to BeginInit and
    ‘ EndInit, the result would have been:

    gridControl1.Columns( 0 ).VisibleIndex = 2
    gridControl1.Columns( 1 ).VisibleIndex = 0
    gridControl1.Columns( 2 ).VisibleIndex = 3
    gridControl1.Columns( 3 ).VisibleIndex = 1

    Imported from legacy forums. Posted by Kai (had 2568 views)

    User (Old forums)
    Member
    Post count: 23064

    I find this very confusing. You’re trying to freeze a column in the middle of the grid? So when the user scrolls horizontally, the same column stays in the middle?
    I may find a way to do this, but the problem will be this: because the columns can have different widths, the frozen middle column will jump around when scrolling horizontally.

    You can freeze a column so it’s always the first visible column (left), like this:

    Xceed.Grid.Column fixedColumn = grid.Columns[“id”]; // ‘id’ is the fixed first visible column
    grid.FirstVisibleColumnChanged += new EventHandler(gridFVCChanged);
    private void gridFVCChanged(object sender, EventArgs e)
    {
    if (fixedColumn == null) return;
    Xceed.Grid.Column col = grid.FirstVisibleColumn;
    if (col != null && col != fixedColumn) fixedColumn.VisibleIndex = col.VisibleIndex;
    }

    Imported from legacy forums. Posted by Tommy (had 210 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Tommy,

    yes, might look a little bit strange, but I don’t have to judge what the users want… 😉 In fact the grid should display sales data on the left and months data on the right. The users want to be able to freeze on the left AND on the right and maybe in the middle….

    Currently I have 2 different scenarios:
    – I could freeze several columns at the left, or
    – I could freeze a single column anywhere.

    As soon as I want to freeze 2 columns in the middle, the system bugs…. I have no idea why, and additionally I understand the grids logic when using within BeginInit and Endinit. If someone could explain this to me this might already help….

    Imported from legacy forums. Posted by Kai (had 3542 views)

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