DataGrid row height same for all rows
Brought to you by:
davideicardi
When setting row height (or using Rows.AutoSize) for DataGrid (maybe it's even for all VirtaulGrids) all rows would be same size as last set row heigth. So after calling Rows.AutoSize all rows are in height measured for last row. I tried to find a reason for it but couldn't on my own. Any hint would be really appreciated as it's quite urgent for me. I will post fix once I find it. Thank's in advance.
Logged In: YES
user_id=1515232
Originator: NO
You are right but this is by design. On some kind of virtual grid you have a single Row instance so a single row height. For now this is how the datagrid work.
Davide
Logged In: YES
user_id=459824
Originator: YES
But anyway it's a bug as VirtaulGrid is not usable if it contains multiline data. Maybe you have any ideas how to change it so that each row would have it's own instance? I really need it so I can devote my time to it but I need a hint from you where to start. Thanks!
Logged In: YES
user_id=1515232
Originator: NO
Here a possible solution (thanks to ornus):
http://www.devage.com/Forum/ViewTopic.aspx?id=8cdcca16b9874ec7a896bffdd470821c
"""""""""""""""""""""
it's impossible to set height for a specific virtual row. Rows.SetHeight uses one value for all rows (RowHeight). so, it's pretty much unusable. I wanted to hide certain row when data source is a data table. couldn't. here's a simple code to fix this to work correctly.
replace RowsSimpleBase.GetHeight & SetHeight with this:
private readonly Dictionary< int, int > _heights = new Dictionary< int, int >();
public void ResetHeights()
{
_heights.Clear();
}
public override int GetHeight(int row)
{
if( _heights.ContainsKey( row ))
{
return _heights[ row ];
}
else
{
return RowHeight;
}
}
public override void SetHeight(int row, int height)
{
_heights[ row ] = height;
}
"""""""""""""""""""""
Davide
P.S. I move this topic on the "Feature Request" section. If you want to continue the discussion post a new message on the www.devage.com forum.