User (Old forums)MemberFebruary 22, 2007 at 9:30 amPost count: 23064
On a WPF GridView, the columns default to the width of their content such that all content is showing. However with the Xceed grid, you have to set the width manually.
Is there any way to get them to default to the width of their content without having to make the user double click on the separator
Imported from legacy forums. Posted by nmosafi (had 2853 views)Xceed SupportMemberFebruary 22, 2007 at 10:16 amPost count: 5658
There is currently no way to specify to a column that it should automatically take its content’s Width.
You can work around this by doing this:
foreach( Column column in this.grid.Columns )
column.Width = column.GetFittedWidth();
By registering to the grid’s Loaded event (if ItemsSource is static), or by placing a Dispatcher call after changes to the ItemsSource property (if dynamic).
However, I’d like to determine exactly what you need, so I can file the appropriate feature request.
When the Fitted Width feature (when double-clicking) is triggered, the DataGridControl only consider the items realized ( because of UI Virtualization).
Do you mean that the Column’s with should always follow the currently visible items width (while scrolling) or just that the Column should initially size at the visible content’s width?
Imported from legacy forums. Posted by Marcus [Xceed] (had 1095 views)User (Old forums)MemberFebruary 22, 2007 at 11:40 amPost count: 23064
I think all I need is to change the widths after the ItemsSource changes and that should be fine
Imported from legacy forums. Posted by nmosafi (had 5098 views)User (Old forums)MemberSeptember 17, 2008 at 1:04 pmPost count: 23064
Has there been any changes or additions regarding setting the column widths to the content width? I would like to one-time size the columns to the width of the largest content. That way we deal with the overhead only once and not when we scroll or change the viewport. I could also see a need for being able to have the column width follow the currently visible items with while scrolling. I’ve tried various implementations of calling GetFittedWidth() on the columns and setting the column Width property to this value, but I end up calling this too often in order to make sure the visible columns are always sized correctly – thus slowing down the datagridcontrol considerably (mostly scrolling).
Imported from legacy forums. Posted by Jared (had 500 views)Xceed SupportMemberSeptember 17, 2008 at 3:22 pmPost count: 5658
Version 3.0 adds starrable (*) column widths and the column-stretching feature (TableView.ColumnStretchMode property). There have not been any modifications made in regards to the GetFittedWidth method.
Imported from legacy forums. Posted by Jenny [Xceed] (had 309 views)User (Old forums)MemberSeptember 17, 2008 at 7:04 pmPost count: 23064
Resizing on scroll should not affect performance much if you use the scroll bar. It only calls the getfittedwidth for the columns on mouseup event. So it really isnt being called all that often.
Imported from legacy forums. Posted by justin (had 2320 views)
- You must be logged in to reply to this topic.