What is the best way to monitor the Layout of a XamDockManager? Is there a single event I can handle when a user moves a pane or changes the layout in any way? Or can you suggest several events to handle? What about when I programmatically call LoadLayout?
In MVVM architecture I have to bind the Layout Xml to a property on my ViewModel. I am building an Attached behavior to do this but can't find the correct event to handle to update my xml string. I already have an attached behavior to facilitate loading a layout from my LayoutInfo object. But but I'm having trouble getting the xml from the dock manager to my VM property when the user has customized their current layout.
Any suggestions are very much appreciated!
thanks.
Hello kcongdon,
Thank you for your post. I have been looking through it and I suggest you use the PaneDragEnded event to update your xml string, because this event occurs evrytime a pane is docked on a different place in the XamDockManager. Please note, we are making efforts to ensure all posts are addressed by an Infragistics expert. We believe that the other community members could benefit from this thread as well.
Feel free to write me if you need further assistance.
Thanks, Stefan.
In my attached behavior I handle the following events of the XamDockManager:
Loaded
ActivePaneChanged
PaneDragEnded
InitializePaneContent
ContentPane.ClosedEvent
FrameworkElement.SizeChangedEvent
Each event is handled in a single method which simply updates my LayoutXML property from the target XamDockManager.
These seem to be working well for us. My only concern is that I'm kindof using a shotgun approach handling a bunch of events, some of which may be redundant. Thus causing the property to be updated more often than necessary.
Also, the FrameworkElement.SizeChangedEvent was an attempt to get new xml when the user resizes a pane, but of course this is only fired when the entire XamDataGrid is resized. So, right now the only layout change that does not get directly handled by my attached property is when a contentpane is resized. To handle this I would have to monitor when panes are added or removed and wire each pane's SizeChangedEvent. I was just looking for a more streamlined way to do this.
Thanks again for your response.
Hello again,
I am glad I helped you. As for your question about size changing, the ContentPane has a SizeChanged event which is fired when it resizes. Please let me know if this meets your requirement or you need any further clarifications on this matter.
Looking forward for your reply.
Nice idea! Thanks, Floele.
The SizeChanged event didn't work for me (events were only fired when the whole window size changed), I used Thumb.DragCompletedEvent additionally which fires whenever a splitter in the layout gets resized.