store location of dragdockpanel for next time when user need it.

Jun 20, 2012 at 8:48 PM

Hi all,

hopefully someone read this and can help me.

I want to store the information of the panels, if a user arranged them new. so the next time the users logs in, he will see them the way he used them.


Is this possible? I know the value i need is stored in currentZIndex but it is not accesible.





Jun 22, 2012 at 8:17 PM

CurrentZIndex is not the property you want.  That value gets incremented whenever GotFocus, OnMouseLeftbuttonDown, or Maximize is called, so it doesn't portray a panel's position in the host.

In order to capture the position, you could create a dependency property (e.g., "PositionIndex") in the DragDockPanel that the host updates in the DragDockPanel_DragFinished event.  You can get the index of all the panels by using the GetOrderedPanels method.  You can then save the index value and the next time the host loads up, just sort the panels by their saved index and add them in that order.

One thing to consider is the possibility of having a maximized panel at the time of your save, in which case you'll need to save the PanelState as well.