Hi,
I have an application where I have created some ToolWindows which the user may open/close with a checkbox-control in the Ribbon. These ToolWindows are always floating, are connected to my DockSite and saved/loaded using the DockSiteLayoutSerializer.
Code fragment showing creation of the serializer and one of the tool-windows:
// Create the layout serializer
_layoutSerializer = new DockSiteLayoutSerializer();
_layoutSerializer.SerializationBehavior = DockSiteSerializationBehavior.All;
_layoutSerializer.DocumentWindowDeserializationBehavior = DockingWindowDeserializationBehavior.AutoCreate;
// Create the MediaPlayer tool-window
MediaPlayerWindow = new ToolWindow(MyDockSite, "MediaPlayerWindow", "Media Player", null, new MyMediaPlayer());
MediaPlayerWindow.CanRaft = true;
MediaPlayerWindow.CanDockBottom = false;
MediaPlayerWindow.CanDockLeft = false;
MediaPlayerWindow.CanDockRight = false;
MediaPlayerWindow.CanDockTop = false;
MediaPlayerWindow.CanBecomeDocument = false;
Show/hide the tool-window:
public void ShowMediaPlayerWindow(bool show)
{
if (show)
{
MediaPlayerWindow.Float();
MediaPlayerWindow.Activate(true);
}
else
MediaPlayerWindow.Close();
}
When the application is closed, I'm calling _layoutSerializer.SaveToString(MyDockSite), and when the application starts up, _layoutSerializer.LoadFromString(xml, MyDockSite).
If I run the application, open and close the tool-window and close the application, the saved xml looks like this:
<RaftingHosts>
<RaftingHost IsMaximized="false" Location="207,207" Size="194,197" State="Floating">
<Content xsi:type="ToolWindowContainer" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="194,197" Size="194,197">
<UIElement xsi:type="Track" UniqueId="854be9f7-0cc5-43bf-a948-a62a643326fe" />
</Content>
</RaftingHost>
</RaftingHosts>
<ToolWindows>
<ToolWindow UniqueId="854be9f7-0cc5-43bf-a948-a62a643326fe" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="194,197" Size="200,200" IsOpen="false" LastState="Docked" Name="MediaPlayerWindow" RaftingLocation="207,207" State="Floating" />
</ToolWindows>
When starting the application, the tool-window briefly "blinks".
If I then open and close the tool-window again, the saved xml looks like this:
<RaftingHosts>
<RaftingHost IsMaximized="false" Location="207,207" Size="192,196" State="Floating">
<Content xsi:type="ToolWindowContainer" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="192,196" Size="192,196">
<UIElement xsi:type="Track" UniqueId="854be9f7-0cc5-43bf-a948-a62a643326fe" />
</Content>
</RaftingHost>
<RaftingHost IsMaximized="false" Location="207,207" Size="192,196" State="Floating">
<Content xsi:type="ToolWindowContainer" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="192,196" Size="192,196" />
</RaftingHost>
</RaftingHosts>
<ToolWindows>
<ToolWindow UniqueId="854be9f7-0cc5-43bf-a948-a62a643326fe" AutoHideSize="200,200" DockedSize="200,200" DocumentSize="200,200" FloatingSize="192,196" Size="200,200" IsOpen="false" LastState="Docked" Name="MediaPlayerWindow" RaftingLocation="207,207" State="Floating" />
</ToolWindows>
When starting the application, the tool-window now "blinks" twice. It seems the "RaftingHosts" section grows for each time I open and close the tool-window, and more annoyingly, the tool-window "blinks" the same amount of times as there are "RaftingHosts" sections.
I assume I'm doing something wrong in my serialization/deserialization, but how can I avoid the "blinking" tool-windows at startup (and the growing "RaftingHosts" section)?
Thanks,
Geir