Home Forums WPF controls Xceed DataGrid for WPF Column resizing

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

    I have two questions on column resizing:

    1. Is it possible to have the grid automatically resize the columns based on content, header, or both? This was a feature of the Windows Forms data grid that was very useful.

    2. When resizing a column by double-clicking on the column divider, it appears that the column is always being resized based on the content in the first row rather than taking into account the data in all of the rows for that column.

    Thanks,

    Scott.

    Imported from legacy forums. Posted by Scott (had 7973 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Scott,

    1. No, there currently is no way to do that right now but I logged the feature request in our database.

    2. I cannot reproduce the problem as you described it… Are you using a custom ControlTemplate for the DataRows or DataCells? What Theme are you using?

    One thing that is worth mentionning about column auto-sizing is that the auto-size will be calculated based on the <i>realized</i> DataRows, i.e. those which are currently visible in the grid’s ViewPort.

    Imported from legacy forums. Posted by Pascal (had 524 views)

    User (Old forums)
    Member
    Post count: 23064

    I look forward to seeing that feature completed. Thanks!

    I am not using any custom templates for the DataRows or DataCells and I am using the Aero theme. Having the column auto-sizing based on the realized DataRows certainly makes sense from a performance standpoint. It is, however, not the cause of my issue as I currently am displaying only 2 rows.

    I can send screen shots and/or a more detailed description of what I am doing if you need it. I can’t attach images to the forum post, so I would need to email them.

    Imported from legacy forums. Posted by Scott (had 476 views)

    User (Old forums)
    Member
    Post count: 23064

    A more detailed description of what you are doing would definitely help me troubleshoot the issue!

    Thanks!

    Pascal

    Imported from legacy forums. Posted by Pascal (had 303 views)

    User (Old forums)
    Member
    Post count: 23064

    I have a collection that ultimately inherits from IBindingList<T> and ITypedList. This collection is bound to the data grid control using the following code (adapted from information that Marcus provided in another post):

    this.ActionTestDataGrid.Columns.Clear();
    Binding bind = new Binding();
    if (documents.Count > 0)
    {
    bind.Source = new ListCollectionView(documents);
    }
    else
    {
    bind.Source = documents;
    }
    this.ActionTestDataGrid.SetBinding(DataGridControl.ItemsSourceProperty, bind);

    The datagrid is set to automatically create columns.

    Currently, the collection returns two rows. One of the columns has the following data in the field (field name is “Name”) in question:

    row 1: New Vendor
    row 2: Second Vendor

    When the rows are in this order and I double-click the column divider to auto resize the Name field, I get the following visually:

    row 1: New Vendor
    row 2: Second Ve…

    If I then manually resize the column to display all of the data and then reorder the rows so they look like this:

    row 1: Second Vendor
    row 2: New Vendor

    When I double-click the column divider, I get the following following visually:

    row 1: Second Vendor
    row 2: New Vendor

    In both conditions, it appears that the auto resize function is only taking in to account the lenght of the data in the first row.

    Thanks,

    Scott.

    Imported from legacy forums. Posted by Scott (had 611 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Scott,

    Sorry for not getting back to you earlier…

    I confirm this is a bug where Column.GetFittedWidth() (the method ultimately called when you double-click on a column splitter) does not always take the last row into account.

    I will post a follow-up here when the fix is available.

    Thanks for reporting this!

    Imported from legacy forums. Posted by Pascal (had 364 views)

    User (Old forums)
    Member
    Post count: 23064

    No problem. I look forward to seeing the fix.

    Imported from legacy forums. Posted by Scott (had 677 views)

    User (Old forums)
    Member
    Post count: 23064

    This has been fixed. Unfortunately, the fix did not make it in time for the update package we released today… The fix will be available in the next service release.

    Imported from legacy forums. Posted by Pascal (had 316 views)

    User (Old forums)
    Member
    Post count: 23064

    A fix has been implemented and the main download package will be updated soon.

    Meanwhile you can download it using this link:
    http://download3.xceedsoft.com/Packages/3.0.7170.16360/XceedComponentsWebInstall.exe

    Imported from legacy forums. Posted by Pascal (had 501 views)

    User (Old forums)
    Member
    Post count: 23064

    <i>1. Is it possible to have the grid automatically resize the columns based on content, header, or both? This was a feature of the Windows Forms data grid that was very useful.
    <b>1. No, there currently is no way to do that right now but I logged the feature request in our database.</b></i>
    When are You planning to implement this feature?

    Imported from legacy forums. Posted by Andrew (had 8442 views)

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