Home Forums WinForms controls Xceed Grid for WinForms Full width, fixed?

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

    Hi all,

    I am evaluating the Xceed Guid, and there are some things I can’t seem to find out how to do.

    1. I would like for the colums to always fill the guid’s size, and you should not be able to drag a column wider, so that another column goes out of the screen – similar, when a scrollbar appears, the rest of the columns should shrink a bit. The functionality is shown in the Microsoft show-off here: http://demo.xceedsoft.com/XceedGrid/Pop_sba.aspx

    2. I don’t wan’t the user to be able to move the colums (drag a colum in front of another). I generally just wan’t the guid to display data, and nothing else.

    How do I do these things?

    Regards,

    Brian

    Imported from legacy forums. Posted by Brian (had 3907 views)

    User (Old forums)
    Member
    Post count: 23064

    1- First, this application is made by Microsoft, so of course we don’t have the source code, and so we don’t actually know how they setup our grid to do what they want. Second, there is no out-of-the-box feature that will allow you to do this.

    Here are some suggestions of what you can do.

    To set the columns to fill the grid, you need to calculate the space that is left and set your last column’s width to it. You need to use the GridControl ClientRectangle, minus the RowSelectorPane, if applicable the VerticalScrollbar, and the Visible Columns. You will need to handle the ScrollBarsChanged event to change the width when the scroll bar appears/disappears.

    As for not permitting a column to become too wide, you could handle the WidthChanged event on the Column, calculate the width of all the elements of the grid (e.g. all columns, RowSelectorPane, etc…) and not let the width of the current column get to a point where the total width gets bigger than the totally width of the grid.

    2- Set the AllowColumnReorder property of the ColumnManagerRow to false.

    Imported from legacy forums. Posted by André (had 307 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi André,

    Thank you for your reply. This certainly gets me something to go with. I hoped there was some internal functionality to do the column with calculations, but it is no problem to add it manually.

    The “AllowColumnReorder” works perfectly.

    Then I have just one other thing I have run into – when setting the grid selection type to “One” or “Multiple”, then I get exceptions when removing or clearing the guid – genereally, if one row is selected, and I delete this, I get an exception – if I select another row before removing it, I don’t get this exception.

    It looks as though the guid requires to always have atleast one row selected – which also means I can’t clear the grid, or delete the last row – there is no other rows to select, and then the exception comes up.

    Is there any way to solve this? If I do a gridObject.DataRows.Clear(), I get this exception, even though I previously called gridObject.SelectedRows.Clear().

    Regards,

    Brian

    Imported from legacy forums. Posted by Brian (had 462 views)

    User (Old forums)
    Member
    Post count: 23064

    This should not be, the SelectedRows collection can be empty, and the grid can be cleared, that is, having no rows in it.

    What is the exact exception you are getting?

    Imported from legacy forums. Posted by André (had 168 views)

    User (Old forums)
    Member
    Post count: 23064

    It’s not very clear:

    ——————————
    An unhandled exception of type ‘System.Reflection.TargetInvocationException’ occurred in Xceed.Grid.dll

    Additional information: Exception has been thrown by the target of an invocation.
    ——————————

    What I do is this:

    ———————
    grdTitles.SelectedRows.Clear()
    grdTitles.DataRows.Clear() <– This line throws the exception.
    ———————

    I should mention that the exception does not come when the list is first populated – I can run the commands then without problems.

    grdTitles.SelectedRows.Count is “1” before the SelectedRows.Clear(), and it is “0” right after, but the “DataRows.Clear()” then fails.

    Could the problem be “grdTitles.CurrentRow”? – When I check for “grdTitles.CurrentRow Is Nothing” it returns False both before and after the SelectedRows.Clear(). But I can’t set the CurrentRow to nothing, as “grdTitles.CurrentRow = Nothing” throws another exception.

    Regards,

    Brian

    Imported from legacy forums. Posted by Brian (had 542 views)

    User (Old forums)
    Member
    Post count: 23064

    You can set the debugger to break on all exceptions (Go to Debug Menu -> Exceptions -> Common Language Runtime Exception, then select “Break into the debugger” radio button, in VS 2003), which should give you the exact exception being raised.

    Apart from that, it is difficult to see what is the problem without a reproduction. Is it possible for you to send a sample application reproducing the issue to <a href=”mailto:support@xceedsoft.com”>support</a>?

    Imported from legacy forums. Posted by André (had 4959 views)

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