Floating window customization

Docking/MDI for WPF Forum

Posted 2 years ago by Anton Chochia
Version: 16.1.0651
Avatar

Hello,

In previous versions we can customize rafting window by defining our own style like follow:

<Style x:Key="{x:Type docking:RaftingWindow}" TargetType="{x:Type docking:RaftingWindow}">

<Setter Property="Title" Value="Raftable Content"/>

<Setter Property="IsTitleAutoUpdated" Value="true"/>

<Setter Property="TitleBarVisibility" Value="{x:Static docking:RaftingWindowTitleBarVisibility.Visible}"/>

<Setter Property="ShowInTaskbar" Value="true"/>

<Setter Property="Background" Value="Transparent" />

<Setter Property="Foreground" Value="{DynamicResource {x:Static themes:AssetResourceKeys.WorkspaceVeryDarkForegroundNormalBrushKey}}" />

<Setter Property="BorderBrush" Value="Red" />

<Setter Property="BorderThickness" Value="4" />

..

</Style>

Is it possible to achieve the similar for floating window?

Thanks.

Comments (6)

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

Hi Anton,

The rafting windows in the new version are all styled the same way as the rest of the app's windows, using our WindowChrome.  There is no real dedicated class for the window like RaftingWindow before.

We do have a virtual protected DockSite.InitializeFloatingWindow method that passes in the Window being created to host the floating dock host.  You could set properties on it in an override of that method before it gets opened.


Actipro Software Support

Posted 2 years ago by Anton Chochia
Avatar

Hi,

While I can change some properties (like BorderThickness) in my DockSite's InitializeFloatingWindow method but some not (BorderBrush, ShowInTaskBar, etc.). Also I notice that this method each time when I start dragging floating window. Let me know if i need anything else to proper change window style. Better if I can do this by defininig style in XAML and set it to floating window. 

protected overridevoid InitializeFloatingWindow(Window window)

{

base.InitializeFloatingWindow(window);

window.Owner = null;

window.BorderThickness = newThickness(20);

window.BorderBrush = Colors.Red.ToSolidColorBrush();

window.WindowStyle = WindowStyle.SingleBorderWindow;

window.ShowInTaskbar = true;

}

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

Hi Anton,

The window gets assigned a WindowChrome instance and the WindowChrome has a default Style that will probably be overriding any border settings you make.

That being said, you can do WindowChrome.GetChrome(window) to get the WindowChrome instance.  It has a StyleKey property that you can point to a resource key in your Application.Resources that is a Style targeting Window.  If you do that, I think it will let you use your own Style.

Also, the ShowInTaskBar I think is set later on after that window.  We have a DockSite.FloatingWindowShowInTaskBarMode property you can check out but I don't think its current options will help your scenario.  Are you trying to make tool windows show up in the taskbar and not be owned by the main window?


Actipro Software Support

Posted 2 years ago by Anton Chochia
Avatar

Hi,

Yes, in our scenario we want to show floating window in the the taskbar even it is not owned by the main window. Currently, HostingWindow which is passed in InitializeFloatingWindow always shown over the main window until Owner property is set to null. But still cannot set ShowInTaskbar property.

Also I tried to use WindowControl in my template in the style for WindowChrome as you suggested (thanks it works), but system buttons (minimize, maximize, close) does not work for floating windows. Also I found resize issue.

Thanks.

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

Hello,

Right now the FloatingWindowShowInTaskBarMode enum has values { Never and Default }.  "Never" will never show floating windows in the taskbar.  "Default" will only show floating windows with dock hosts that contain workspaces in the taskbar.

Would you like to see another option added like "Always" that would apply to floating documents and tool windows?  That would also alter the Owner to null.  Would that accomplish what you need?

For the WindowChrome issue you saw, perhaps you didn't clone our default style/template to start with?  There are certain pieces in that which are probably needed for things to work well.  I'd recommend starting with a default template and adjusting it as needed.  Please write our support address if you need the official XAML source of the WindowChrome style/template.


Actipro Software Support

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

Hi Anton,

We have added the FloatingWindowShowInTaskBarMode.Always option for the next maintenance release (2017.1 build 652).


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.