This is a migrated thread and some comments may be shown as answers.

Floating Window in combination with MVVM

2 Answers 230 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 01 Dec 2016, 01:20 PM

Hello,

i'm using the Telerik Dock Controls.

In order to mvvm i'm using the binding to the Property PanesSource.

I Add a login Screeen at startup and want to show it in the center of the application and not docked to any of my SplitContainers.

The XAML head of the RadPane looks as followed:

<telerik:RadPane x:Class="ProductLifecycle.Frontend.UI.UserControls.LoginPage"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:ProductLifecycle.Frontend.UI.UserControls"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 xmlns:viewModels="clr-namespace:ProductLifecycle.Frontend.ViewModels"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300" Header="{Binding Title}"
                 d:DataContext="{d:DesignInstance viewModels:LoginPage, IsDesignTimeCreatable=False}"
                 telerik:RadDocking.DockState="FloatingOnly" telerik:RadDocking.FloatingSize="300,200" CanUserClose="False" CanUserPin="False" CanDockInDocumentHost="False" >

 

Everytime when i add this Control to my Binded Collection this window appears in the left of the docking control.

How can i start this window as floating window in front of my application?

Thanks,

Michael

2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 02 Dec 2016, 09:13 AM
Hi Michael,

In order to achieve the desired functionality and preserve the MVVM pattern what we could suggest you is to use custom DockingPanesFactory. Inside the AddPane method (after its base implementation is executed) you need to call the MakeFloatingDockable method for the Pane that you want to make floating and using the FloatingLocation attached property to position it as desired.

We have created a sample project that demonstrates the described above approach and you could run and evaluate it.

Hope this helps.

Regards,
Nasko
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Michael
Top achievements
Rank 1
answered on 05 Dec 2016, 07:53 AM

Hi Nasko,

thanks for your help. This is exactly what i was looking for. I already created a CustomPanesFactory so I only had to set the property and executed the method in case that it is a floating window.

 

Thanks and Regards,

Michael

Tags
Docking
Asked by
Michael
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Michael
Top achievements
Rank 1
Share this question
or