This project is read-only.

DockableContent style

Aug 27, 2009 at 9:08 PM

Is it possible to prevent that user change DockableContent in floating state?
I would like to dock DockableContent in DockablePanes, but prevent to change it in floating state.

Thanks for help in advance!

Aug 28, 2009 at 12:47 PM

Hi,
so you need an event to show you, that the window changed to floating-mode?

Or do you want it to do automatically?

 

Aug 28, 2009 at 4:25 PM

It would be fine to do it automatically.

Also event would be fine.

Thanks again!

Aug 30, 2009 at 4:56 PM

Hi si124,

I think, I did it:

Change in DockableContent.cs the beginning of region State Properties & Events

        #region State Properties & Events
        public delegate void DockableContentStateHandler(object sender, DockableContentState state);

		public event DockableContentStateHandler StateChanged;

        public DockableContentState State
        {
            get { return (DockableContentState)GetValue(StatePropertyKey.DependencyProperty); }
            protected set 
            { 
                SetValue(StatePropertyKey, value);
                if (StateChanged != null)
                    StateChanged(this, value);
            }
        }

So you have an event when the state changes.
You can use it in xaml like:

<ad:DockableContent x:Name="_propertiesWindow" Title="Properties" DockableStyle="Dockable" StateChanged="_propertiesWindow_StateChanged">
And the event in code like:
        private void _propertiesWindow_StateChanged(object sender, DockableContentState state)
        {
            MessageBox.Show(state.ToString());
        }

Best regards,
Juergen

Sep 5, 2009 at 12:13 PM

First of all. Thank you very much for your time.

I tried it, but state is never DockableContentState.FloatingWindow:

private void DockableContent_StateChanged(object sender, DockableContentState state)
{
      if (state == DockableContentState.FloatingWindow)
                //never works....
}
Thanks for help in advance!!!
Simon
Sep 5, 2009 at 7:09 PM

When the state is changed to floating mode, it will return "DockableWindow".

When you dock it, it's "Docked"

 

Juergen