ToolWindow State

Docking/MDI for WPF Forum

Posted 10 years ago by Iosu Buenetxea
Avatar
Hi!

It's very easy to know about the actual State of any ToolWindow but I'm interested about knowing WHEN the ToolWindow CHANGE the State. It would be nice to have StateChanged event (even StateChanging). Is there any workaround to know it?

Thanks in advance!

Comments (4)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Iosu,

I'll mark this request down to add an event.

If you are inheriting ToolWindow with a custom class, you could possibly override OnPropertyChanged and look for the state property value to change. That may be a workaround for now.


Actipro Software Support

Posted 9 years ago by nash
Avatar
I need to do track when the state of toolwindow changes. And need to add code if it is in floating state or docking state. This code is related to sizing issue. The content should resize according to the space available when tool window is floating and when user changes the size of toolwindow.
So first step, I created custom class from ToolWindow named ActiveProToolWin.
 
 public ActiveProToolWin(DockSite docksite, string name, string title, ImageSource image_source, object content) :
            base(docksite, name, title, image_source, content)
        {
            StateProperty.OverrideMetadata(typeof(ActiveProToolWin), new FrameworkPropertyMetadata(new PropertyChangedCallback(StatePropertyChanged)));
           // OnPropertyChanged("StateProperty");
            
        }
But it is showing error
" 'State' property was registered as read-only and its metadata cannot be overridden without an authorization key."
I tried another piece of code in my custom class.

 protected override void OnStateChanged(DockingWindowState oldValue, DockingWindowState newValue)
        {
            base.OnStateChanged(oldValue, newValue);
            ToolWindowState = newValue;
            

        }
Now it is tracking the state change but how i am gonna code what i want.
I am missing something here.
Does any one get same problem?
Thanks,
N
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The StateProperty is a read-only dependency property, so you cannot override the metadata. If you explain briefly what you are trying to accomplish, we may be able to help.


Actipro Software Support

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

Just FYI, we've added a DockSite.WindowStateChanged event in WPF Studio 2011.2 build 0551.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) 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.