views:

11

answers:

1

Hi!

I have a (main)window containing a Frame. A Page is loaded to that frame, with some viewmodel as its datacontext.

The View has some datagrids, where one is bound to the viewmodel and the other is bound to the selected.item (so that you get a master-details view..)

the problem occurs when I display a popup box, and set the mainwindow IsEnabled = false. When that happens, the selected item from the datagrid bound to the viewmodel gets unselected, and of course the other datagrids selected items get unselected as well.

How can I preserve the "state" of the UI when my mainwindow.IsEnabled get set to false?

A: 

It seems the builtin behaviour of the datagrid is to deselect the selected item when the datagrid gets disabled - just verified this myself.

But try this:

Create a simplistic ListView, add some data, select an item, click a button to disable the ListView. If the selected item gets deselected, then this behaviour is by design in WPF. Not much you can do about it I think. Other than not disabling your controls...

If the selected item does not get deselected you can open a bug in Connect. It might take months to get a reply and a fix "might" come in a couple of years... If such a wait is not an option the also post a bug in the WPF toolkit (wpf.codeplex.com). The toolkit might get updated sooner.

Marko