We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Strange behavior with floating windows

Hi,

I'm migrating (kinda try to) an application built with a competitor product to your control suite.

I have a simple WPF Window with this content:

   <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="120"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="#FFA52821">
<Button Content="Test" Click="Button_Click" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="12"/>
<TextBlock Text="Test" FontFamily="Helvetica" FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" />
</Grid>
<Grid Grid.Row="1">
<syncfusion:DockingManager x:Name="dManager" UseDocumentContainer="True" UseNativeFloatWindow="True">
<ContentControl x:Name="SolutionExplorer" syncfusion:DockingManager.Header="Solution Explorer" />
<ContentControl x:Name="ToolBox" syncfusion:DockingManager.Header="Toolbox"  syncfusion:DockingManager.State="Float" />
<ContentControl x:Name="Properties" syncfusion:DockingManager.Header="Properties" syncfusion:DockingManager.ShowInTaskbar="False" syncfusion:DockingManager.DesiredMinWidthInFloatingMode="120" syncfusion:DockingManager.DesiredMinHeightInFloatingMode="100" syncfusion:DockingManager.SizetoContentInDock="True">
<Grid Background="Orange" Height="100" Width="120">
</Grid>
</ContentControl>
<ContentControl x:Name="Output" syncfusion:DockingManager.Header="Output"/>
<ContentControl x:Name="StartPage" syncfusion:DockingManager.Header="Start Page" syncfusion:DockingManager.State="Document" />
</syncfusion:DockingManager>
</Grid>
    </Grid>

(Sorry for the format but I found no "paste code" in your forums)

I also (since I found no way to bind "hidden / visible" for a window) use code behind like this:

public MainWindow() {
InitializeComponent();
Loaded += MainWindow_Loaded;
}

private void MainWindow_Loaded(object sender, RoutedEventArgs e) {
DockingManager.SetState(Properties, Syncfusion.Windows.Tools.Controls.DockState.Float);
}

private void Button_Click(object sender, RoutedEventArgs e) {
if(DockingManager.GetState(Properties) == DockState.Hidden) {
DockingManager.SetState(Properties, Syncfusion.Windows.Tools.Controls.DockState.Float);
}
else {
DockingManager.SetState(Properties, Syncfusion.Windows.Tools.Controls.DockState.Hidden);
}
}

What happens when I start the application is this:
The "Toolbox" is somehow "invisible" (I can find it with task switching) as a very small window (and I also get a "ghost" window on my primary screen) which I can move / resize using the system menu via keyboard.

The "Properties" window (which I set to float in code behind) has a correct size - but it behaves also strange!!!
It is hidden behind my main window. And when I use ALT+TAB I see three elements MainWindow, Toolbox and Properties.
All of them behave as independent windows. When I switch to properties it shows on top of my main window - but when I activate the main window it's hidden behind it again.
After I use my button to hide / show the Properties window this works as expected (always above the main window).
syncfusion:DockingManager.DesiredMinHeightInFloatingMode="100" has no effect - windows can be changed in size without restriction.

By the way - when I set "UseNativeFloatWindow="False" the things work (almost) as expected.
Also syncfusion:DockingManager.DesiredMinHeightInFloatingMode="100" works in this case.
BUT then I'm not able to move a floating window to a second screen (which is a must for my solution).

6 Replies

SM Subashini Mahendran Syncfusion Team February 8, 2019 01:39 PM UTC

  
 
Hi Manfred, 
 
Thank you for contacting Syncfusion support. 
 
Query 1: NativeFloatWindow size is not updated properly in DockingManager. 
 
We have checked your query “NativeFloatWindow size is not updated properly in DockingManager”. We were able to reproduce the reported behavior and we will correct it at our end. But, by setting the  FloatingWindowRect attached property of DockingManager, we can able to set the desired size for FloatWindow. Please find the code snippet and sample for the same from the below location.  
<syncfusion:DockingManager x:Name="dManager" UseDocumentContainer="True" UseNativeFloatWindow="True"> 
      <ContentControl x:Name="SolutionExplorer" syncfusion:DockingManager.Header="Solution Explorer" /> 
      <ContentControl x:Name="ToolBox" syncfusion:DockingManager.Header="Toolbox"  syncfusion:DockingManager.State="Float" syncfusion:DockingManager.FloatingWindowRect="100 100 100 100" /> 
      <ContentControl x:Name="Properties" syncfusion:DockingManager.Header="Properties"  syncfusion:DockingManager.DesiredMinWidthInFloatingMode="120" syncfusion:DockingManager.SizetoContentInDock="True"> 
           <Grid Background="Orange" Height="100" Width="120"> </Grid> 
      </ContentControl> 
      <ContentControl x:Name="Output" syncfusion:DockingManager.Header="Output"/> 
      <ContentControl x:Name="StartPage" syncfusion:DockingManager.Header="Start Page" syncfusion:DockingManager.State="Document" /> 
</syncfusion:DockingManager> 
  
 
Query 2: NativeFloatWindow is hidden behind my main window. 
 
In DockingManager, when we set NativeFloatWindow as true we have used normal WPF window. So, only native float window hide behind the Main Window. It is default behavior of WPF window. You can also check this behavior, by showing a window in your WPF application. 
 
Query 3: DesiredMinHeightInFloatingMode="100" has no effect in DockingManager FloatWindow 
 
In DockingManager, Currently there is no support to Set DesiredMinWidth  and DesiredMinHeight for NativeFloatWindow.  We have already added it to our feature request list and it can be tracked through our Features Management System: 
 
Query 4:  I'm not able to move a floating window to a second screen (which is a must for my solution). 
 
We have checked your query “Not able to move a floating window to a second screen”, but we were unable to see the reported behavior at our end. It properly moves the float window to secondary monitor. Can you please provide more details regarding whether you are facing this issue in particular monitor. And also please provide more details about your secondary monitor in which you are trying to move float window. It would be more helpful to proceed further and resolve this issues as earlier.  
 
Regards, 
Subashini M. 
 



MA ManniAT February 8, 2019 05:07 PM UTC

About 4 - floating window on second screen. This only works when the window is set to native which has a lot of negative side effects. By the also your documentation says ...second monitor only with native...

About 2 - when I hide the window and show it again it stays on top of the parent window. So after doing  this it works as expected - but not without doing this. I guess that the window is somehow not properly initialized.

What I finally want to get is the same as visual studio does - dock a window, undock it and place it any screen - and finally have those windows beeing a child of the main window - so when I click on the main window also the other windows are brought to font, and all of them (when overlapping) stay on top of the main window.

Just copy my sample code to a wpf app hit test (hide / unhide) twice and thats what I want to achive - but of course without the need to hide / unhide before.
And of course respecting minwidth / height.


JP Jagadeesan Pichaimuthu Syncfusion Team February 11, 2019 12:47 PM UTC

Hi Manfred, 
 
Thanks for your update. 
 
Currently we are validating your requirements “Need to show all NativeFloatWindow above its parent window” and “Providing MinHeight and MinWidth support for NativeFloatWindow” in DockingManager. And will update you with the complete details by February 12th, 2019. 
 
Regards, 
Jagadeesan 



JP Jagadeesan Pichaimuthu Syncfusion Team February 12, 2019 11:30 AM UTC

Hi Manfred, 
 
Thanks for your patience. 
 
We have prepared a word around sample based on your requirement in which we have shown all NativeFloatWindow above its Parent window and also set the MinHeight and MinWidth for NativeFloatWindow in DockingManager. Please find the code snippet and sample for the same from below location: 
 
public partial class MainWindow : Window 
{ 
     public MainWindow() 
     { 
          InitializeComponent(); 
          Loaded += MainWindow_Loaded; 
          dManager.Loaded += DManager_Loaded; 
          dManager.WindowResizing += DManager_WindowResizing;                 
     } 
 
     private void DManager_WindowResizing(object sender, WindowResizingEventArgs e) 
     { 
          if((sender is NativeFloatWindow)) 
          { 
               NativeFloatWindow window = sender as NativeFloatWindow; 
               window.MinWidth = DockingManager.GetDesiredMinWidthInFloatingMode(window.PrimaryElement); 
               window.MinHeight = DockingManager.GetDesiredMinWidthInFloatingMode(window.PrimaryElement); 
          }         
     } 
 
     private void DManager_Loaded(object sender, RoutedEventArgs e) 
     { 
          foreach(Window win in Application.Current.Windows) 
          { 
              if (win is NativeFloatWindow) 
              { 
                 win.Owner = this;                    
              } 
          } 
     } 
} 
 
 
Please try this above solution and let us know if it is helpful.  
And also we have checked the reported secondary monitor issue, in our side we are still able to access FloatWindow in secondary monitor(4k), but while using float window we faces only resizing issue.  
 
Regards, 
Jagadeesan


MA ManniAT February 12, 2019 07:53 PM UTC

Hi,

thank you for your efforts.
I didn't try it since code behind is not a solution for me...

First I use MVVM - and second I want to use the control on several place. This can be a window - a usercontrol, a custom control and so forth.
There is also the "IsHidden" or so problem - so last not least it's to much fiddling around to achieve what I want.

Or in other words - I want to use the control as it is - without any "plumbing code" or other types of workaround.

Anyhow - you can mark this issue as closed.

And although this control doesn't provide the level of quality I expect; your support is outstanding. I really  impressed!

Thank your for your help
Manfred


JP Jagadeesan Pichaimuthu Syncfusion Team February 13, 2019 09:47 AM UTC

Hi Manfred, 
 
Thanks for the response.  
 
Please get back to us if you require further assistance from us. 
 
Regards, 
Jagadeesan 


Loader.
Up arrow icon