Add button in the titlebar of the toolwindow.

Docking/MDI for WPF Forum

Posted 8 years ago by keshav bansal
Version: 11.2.0554
Avatar

Hi,

How to add custom  button in the titlebar of the toolwindow. 

For example.I want to add my own  help icon as the button in the titlebar of any toolwindow that is registered using the PrismIntegration. 

Comments (7)

Answer - Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Keshav,

You would have to customize the Style/ControlTemplate of the ToolWindowContainer in order to add a custom button. You can take our default Style and then tweak it to your needs, so you don't have to build your Style/ControlTemplate from scratch.


Actipro Software Support

Posted 8 years ago by keshav bansal
Avatar

Hi,

If i added the custom button in the custom ControlTemplate of the ToolWindowContainer then how to define the data binding for that added custom button.

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

Hi Keshav,

What properties of the button are you trying to bind to?

The ToolWindowContainer itself doesn't really have a DataContext, other than the one inherited from the DockSite. You can bind to the SelecedWindow property of the ToolWindowContainer to get the currently selected window, and you could then get the view model for that window using the DataContext property (e.g. "{Binding Path=SelectedWindow.DataContext, RelativeSource={RelativeSource TemplatedParent}}").


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

I had download the styles for the docking window and then i am not able to add the extra buttons in the tityle bar of the docking window.

How to customize the Style/ControlTemplate of the ToolWindowContainer in order to add a custom button ?

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

Hi Keshav,

If you look in our Containers.xaml file you can see where our ToolWindowContainer is defined and the title bar buttons are listed in there.  You'd need to clone that style, remove the x:Key, modify as needed, and put it in your App.Resources.


Actipro Software Support

Posted 7 years ago by keshav bansal
Avatar

Hi,

If i added the custom button in the custom ControlTemplate of the ToolWindowContainer then how to define the data binding for that added custom button.

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

Hi Keshav,
For the binding of your custom button you'll have to make a command and set up a command binding at or above the DockSite level in the main window. That will handle the clicks of the button on the docked tool windows, but not when the windows are rafted, because they are in a separate RaftingWindow. So here you'll have to inherit DockSite and override the CreateRaftingWindow like you did before, call the base method, and put a command binding on the returned RaftingWindow before returning it from the overridden function.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.