Alter appearance of Toolwindow

Docking/MDI for WPF Forum

Posted 10 years ago by Alexandre De Riemaecker
Version: 4.5.0483
Avatar
We use nested docking for our application and want to make the Toolwindows from the inner Docksite clearly disctinctable from the parent Docksite (especially for undocked Toolwindows from both Docksites). So far, tinting the RessourceDictionary of the currently selected theme seems to be a good solution.
Unfortunately, Toolwindows aren't customized with the theme. It is probably interop and doesn't offer any customization possibilities, or does it?

A. De Riemaecker

Comments (7)

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

Yes tinting the theme used for the inner dock site is a good way to do this.

For the tool windows not being customized question, I assume you mean when they are rafted (floating or undocked). That is correct, in those cases it is the system that is drawing their title and border, not us.

However if you use the hosted rafting window option, then we draw all the rafting tool windows and they do get themes. The downside of that in a Windows app is that the tool windows can't extend outside of the DockSite area.


Actipro Software Support

Posted 10 years ago by Alexandre De Riemaecker
Avatar
Thank you for your answer.
Besides the fact that the system toolwindows aren't an actipro issue, could you give me some directions how to achieve the desired behavior, if feasible?

A. De Riemaecker
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Alexandre,

This is something that we want to implement and is on our TODO list but we haven't had a chance to do it yet. Docksite has a protected virtual CreateRaftingWindow method you may be able to override to customize the Window that is created and maybe retemplate it and use no border. But that could be a bit tricky. What we plan on eventually doing is putting a WindowControl (from the Docking/MDI product library) on a Window with no border. Then wiring up functionality between the two.

If it's something you need immediately, then you can always contract us to build it:
http://www.actiprosoftware.com/Purchase/ConsultingServices.aspx

Otherwise, we do eventually want to get it in but I don't have a timeframe for you.


Actipro Software Support

Posted 10 years ago by Alexandre De Riemaecker
Avatar
I've now solutioned the problem successfully. The only thing missing is the docking behaviour of the window when dragging it over the DockSite. I've hidden the borders of the window and retemplated it as proposed. I use DragMove() in order to drag the Window. What could I do in order to make the docksite recognize the object dragging over?

A. De Riemaecker
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Alexandre,

Right now dragging and previewing, etc. is started when certain Windows messages are received by the Window. Namely we handle these:
WM_CLOSE
WM_NCLBUTTONDOWN
WM_NCLBUTTONDBLCLK
WM_NCRBUTTONDOWN
WM_NCRBUTTONUP

So your only option would probably be to manually send those messages to the window to invoke the normal behavior.


Actipro Software Support

Posted 10 years ago by Alexandre De Riemaecker
Avatar
Adding the following handler to the window did almost what I need to:


public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

 void window_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                ReleaseCapture();
                IntPtr hwnd = new WindowInteropHelper((Window)sender).Handle;
                SendMessage(hwnd, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }
        }
However, an exception is printed in the console when WM_LBUTTONUP occurs (Whenever it's over the client area or not). Any idea?

Unhandled exception (System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
 bei bd.a(Object A_0, DockingPreviewEventArgs A_1)
 bei ar.a(DockingPreviewEventArgs A_0)
 bei ar.a(Object A_0, MouseButtonEventArgs A_1)
 bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
 bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
 bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
 bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
 bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
 bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
 bei System.Windows.Input.InputManager.ProcessStagingArea()
 bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
 bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
 bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
 bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
 bei System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
 bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
 bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
 bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
 bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler))
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Alexandre,

It's hard to say without debugging it. Maybe email over a simple sample project that shows it happening and we can take a look.


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.