WPF - How to stop an ItemsControl psuedo-grid's columns from dancing/jumping around during layout?

I wonder if the folks that can't reproduce this problem are dodging it because they're not doing anything to cause the independent Grid's to resize Simple TextBlock's as shown in the OP probably don't manifest the problem quite as readily because they're static size. If you throw a TextBox (not TextBlock) in a cell, then at run-time, enter enough text to cause the TextBox to auto expand the cell, you should see it start dancing wildly right away... it's well over the too-much-to-be-acceptable line. I had 7 rows in my ItemsControl This effectively renders the much promoted IsSharedSizeScope + ItemsControl approach to be a complete no-go, specifically for editable, TextBox oriented Grid content For my needs, the ListView or rather "ItemsControl + GridViewRowPresenter" approach as presented here and here is a very direct alternative and does not have any of these layout issues For those asking "why not a DataGrid?": the DataGrid imposes a certain approach to editing.

I was willing to work through all that but wound up at a dead end with how the DataGrid mangles Validation. Error support. The little red Validation Error boxes would work fine for simple DataGridTextColumn's but for DataGridTemplateColumns (necessary to provide more than a single TextBox in one column), it would initially show the red boxes and then inconsistently hide them based on where you happened to click around the DataGrid.

Upon subsequent Validation refreshes they would be completely invisible. (old example: http://code.google.com/p/itraacv2/source/browse/trunk/scraps/tabSponsor%20-%20before%20deactive%20rewrite.xaml search down to "nugget: for the friggin life of me" ...) My entire project source is online, this GridViewRowPresenter approach is represented here: http://code.google.com/p/itraacv2/source/browse/trunk/App/Views/tabSponsor.xaml.

I wonder if the folks that can't reproduce this problem are dodging it because they're not doing anything to cause the independent Grid's to resize. Simple TextBlock's as shown in the OP probably don't manifest the problem quite as readily because they're static size. If you throw a TextBox (not TextBlock) in a cell, then at run-time, enter enough text to cause the TextBox to auto expand the cell, you should see it start dancing wildly right away... it's well over the too-much-to-be-acceptable line.

I had 7 rows in my ItemsControl. This effectively renders the much promoted IsSharedSizeScope + ItemsControl approach to be a complete no-go, specifically for editable, TextBox oriented Grid content. For my needs, the ListView or rather "ItemsControl + GridViewRowPresenter" approach as presented here and here is a very direct alternative and does not have any of these layout issues.

For those asking "why not a DataGrid? ": the DataGrid imposes a certain approach to editing. I was willing to work through all that but wound up at a dead end with how the DataGrid mangles Validation.

Error support. The little red Validation Error boxes would work fine for simple DataGridTextColumn's but for DataGridTemplateColumns (necessary to provide more than a single TextBox in one column), it would initially show the red boxes and then inconsistently hide them based on where you happened to click around the DataGrid. Upon subsequent Validation refreshes they would be completely invisible.(old example: http://code.google.com/p/itraacv2/source/browse/trunk/scraps/tabSponsor%20-%20before%20deactive%20rewrite.xaml, search down to "nugget: for the friggin life of me" ...) My entire project source is online, this GridViewRowPresenter approach is represented here: http://code.google.com/p/itraacv2/source/browse/trunk/App/Views/tabSponsor.xaml.

Archimed, thanks for trying this. I've seen it happen in a few different places in my UI with as few as 5 rows, and have had to go for fixed width columns without IsSharedSizeScope to avoid the jiggling. I wonder whether it's related to hosting my elements within WinForms ElementHosts... – Drew Noakes Nov 25 '09 at 10:38.

It seems the grid's content must be a certain level of complexity before this problem is visible. Simple TextBlock's as shown in the OP probably don't manifest the problem quite as readily because they're static size. If you throw a TextBox (not TextBlock) in a cell, then at run-time, enter enough text to cause the TextBox to auto expand the cell, you should see it start dancing wildly right away... it's well over the too-much-to-be-acceptable line.

I had 7 rows in my ItemsControl. This effectively renders the much promoted IsSharedSizeScope + ItemsControl approach to be a complete no-go, specifically for editable, TextBox oriented Grid content. For my needs, the ListView or rather "ItemsControl + GridViewRowPresenter" approach as presented here and here is a very direct alternative and does not have any of these layout issues.

For those asking "why not a DataGrid?": the DataGrid imposes a certain approach to editing. I was willing to work through all that but wound up at a dead end with how the DataGrid mangles Validation. The little red Validation Error boxes would work fine for simple DataGridTextColumn's but for DataGridTemplateColumns (necessary to provide more than a single TextBox in one column), it would initially show the red boxes and then inconsistently hide them based on where you happened to click around the DataGrid.

Upon subsequent Validation refreshes they would be completely invisible. My entire project source is online.

It seems the grid's content must be a certain level of complexity before this problem is visible.

Unfortunately I wasn't been able to reproduce the problem with the code provided. I've tried it swapping samples of 20 up to 1000 items, and with 100 different widths inside the collection. Nothing was dancing.

On huge collections (200 and higher) UI used to hang for a while and then release, showing new grid with the items provided.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions