Saving AutoHide on toolwindow with Binding

Docking/MDI for WPF Forum

Posted 15 years ago by Martin - Blaise - Statistics Netherlands
Version: 4.5.0485
Avatar
At the moment i am saving properties of windows etc in a Usersettings (user.config) file using binding. E.g. binding the size of the Bottom Dock container:

DockSite.ControlSize="{Binding Source={x:Static props:Settings.Default}, Path=BottomToolWindowControlSize, Mode=TwoWay}
This works.

Now i want to save the AutoHide property of the containers or windows. Please give me a hint, i cant find it:(

Txs
Martin

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Martin,

Do you mean if tool windows are in auto-hide state? If so, what you really should be doing is using our layout serialization mechanism instead. This allows you to save to an XML string the layout and restore it later. So save it on app window closing and restore it when you reload your app later. You can save the XML in your app settings to persist it.


Actipro Software Support

Posted 15 years ago by Martin - Blaise - Statistics Netherlands
Avatar
Ok, done.

I store the original layout too. If a reset of the IDE is called, the IDE is deserialized again with original layout (which, btw is stored in the settings file too). This works, but doesnt look nice. the layout isnt suspended so you actually see toolwindows resizing.
        private void ResetIDESetting_Executed(object sender, ExecutedRoutedEventArgs e) {
            string orgLayout = StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayoutOriginal;
            StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.Reset();
            StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayoutOriginal = orgLayout;
            StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayout = orgLayout;
            LoadToolWindowsLayout();
            e.Handled = true;
        }
and the LoadToolWindowsLayout:
        private void LoadToolWindowsLayout() {
            Actipro.Controls.Docking.Serialization.DockSiteLayoutSerializer ser = new Actipro.Controls.Docking.Serialization.DockSiteLayoutSerializer();
            try {
                // if org = empty
                if (String.IsNullOrEmpty(StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayoutOriginal)) {
                    StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayoutOriginal = ser.SaveToString(_IDE.TheDockSite);
                }
                string layout = StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayout;
                if (!String.IsNullOrEmpty(layout)) {
                    ser.LoadFromString(layout, _IDE.TheDockSite);
                }
            } catch {
                Trace.WriteLine("Unable to restore toolwindow layout");
                StatNeth.Blaise.IDE.ControlCentre.Properties.Settings.Default.ToolWindowLayout = string.Empty;
            }
        }
Is there a possibility to suspend the layout during updating?

Txs
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Martin,

When I run our main Docking/MDI demo, move a lot of things around and use the file menu's load layout option, I don't really see things moving. The new layout just shows up.

I'm not sure there is a way to do any other sort of layout suspension. Right now, layouts are caused by InvalidateArrange calls which tell the dispatcher to perform a layout later once the current executing code is done. So really the layouts should be occuring at one time once the dispatcher calls the layout phase.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.