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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bind "opened / closed" for a window

Thread ID:

Created:

Updated:

Platform:

Replies:

142521 Feb 7,2019 02:34 PM UTC Feb 13,2019 09:48 AM UTC WPF 5
loading
Tags: DockingManager
ManniAT
Asked On February 7, 2019 02:34 PM UTC

Is there a way to bind "hidden / vivsible" for a window in a simple way.
I currently use a competitors product and the it is pretty easy just like <....IsHidden="{Binding IsChecked}"...

This enables a straight forward way to have a list of ToggleButtons which are use to show / hide windows.

I found  syncfusion:DockingManager.State and tried this here (using a converter bool to Float / Hidden) but restoring places the floating (on different monitor) window right above the parent window (changing the size also).

Further problem with this approach - while (with the competitor) setting IsHidden true / false maintains the state (docked, pinned, floating, document...) here I have to remember this somehow.
I found no solution to achieve this without code behind (including to save the state before close to enable a proper "reopen").

By the way "checkbox / ToggleButtons" are just one way - also (like in VS View menu) checked menu items are a typically used for this.
So I tend to say it's very common to show / hide a window.
By the way - with your competitors product this binding works two way - so if the user closes the window with the close button (little x) my ToggleButton get's unchecked.


Subashini Mahendran [Syncfusion]
Replied On February 8, 2019 03:56 PM UTC

Hi Manfred 
  
Thank you for contacting Syncfusion support.  
 
We have checked your query “Is there a way to bind "hidden / visible" for a window in a simple way”. We have prepared a sample based on your requirement in which we hide and shown the DockingManager child window while checking and UnChecking CheckBox, and also if we close the child window using close button CheckBox automatically gets unchecked using Convertor. Please find the sample and video for the same from the below location. 
 
 
And also we does not face child window size changing problem while hiding and showing it using CheckBox. If we misunderstood your requirement, please provide more information regarding your requirement. It would be more helpful to proceed further and resolve this issues as earlier.  
 
Regards, 
Subashini M. 


ManniAT
Replied On February 9, 2019 09:37 AM UTC

Hi,

thank you for the sample.

First I found the "placing / sizing problem" -- this only happens when I change the value in VS debug xaml directly.

About your solution - this is exactly what I wrote in my question:
Further problem with this approach - while (with the competitor) setting IsHidden true / false maintains the state (docked, pinned, floating, document...) here I have to remember this somehow.
I found no solution to achieve this without code behind (including to save the state before close to enable a proper "reopen").

When I pin the window it hides - but "show it again" (of course) shows it floating.
And if I tab-pin it the situation is worse - I attached a scrrenshot showing both (hidden / shown) states.
Hidden shows it tabbed - shown shows it floating - including an tab-title in the container.



Subashini Mahendran [Syncfusion]
Replied On February 11, 2019 04:17 PM UTC

Hi Manfred, 
 
Sorry for inconvenience caused. 
 
We have checked the following reported “Hidden shows it tabbed - shown shows it floating - including an tab-title in the container” issue, it occurs due to previous work around sample suggested and please ignore it. Since, we do not have direct option in our DockingManager to hide and show the dock child. We have prepared sample to meet your requirement in which we have used IsHidden property of DockChildAdapter to show or hide the dock child in DockingManager.  
 
XAML: 
<syncfusion:DockingManager Grid.Row="1" x:Name="dManager" UseDocumentContainer="True" DockStateChanged="dManager_DockStateChanged"> 
     <ContentControl x:Name="SolutionExplorer" syncfusion:DockingManager.Header="Solution Explorer" /> 
     <ContentControl x:Name="Properties" syncfusion:DockingManager.Header="Properties" syncfusion:DockingManager.ShowInTaskbar="False"> 
          <Grid Background="Orange" Height="100" Width="120"> 
          </Grid> 
      </ContentControl> 
 
      <ContentControl x:Name="ToolBox" syncfusion:DockingManager.Header="Toolbox" local:DockChildAdapter.IsHidden="{Binding Path=IsChecked, ElementName=checkBox, Mode=TwoWay, Converter={StaticResource valueconverter}}"  syncfusion:DockingManager.State="Float" syncfusion:DockingManager.FloatingWindowRect="100 100 100 100"/> 
      <ContentControl x:Name="Output" syncfusion:DockingManager.Header="Output"/> 
      <ContentControl x:Name="StartPage" syncfusion:DockingManager.Header="Start Page" syncfusion:DockingManager.State="Document" /> 
</syncfusion:DockingManager> 
 
C#: 
 
public class DockChildAdapter 
{ 
     public static bool GetIsHidden(DependencyObject obj) 
     { 
        return (bool)obj.GetValue(IsHiddenProperty); 
     } 
 
     public static void SetIsHidden(DependencyObject obj, bool value) 
     { 
        obj.SetValue(IsHiddenProperty, value); 
     } 
 
     // Using a DependencyProperty as the backing store for IsSpecialTab.  This enables animation, styling, binding, etc... 
     public static readonly DependencyProperty IsHiddenProperty = 
            DependencyProperty.RegisterAttached("IsHidden", typeof(bool), typeof(DockChildAdapter), new PropertyMetadata(true, null, ExampleCoerceValueCallBack)); 
 
      private static object ExampleCoerceValueCallBack(DependencyObject d, object value) 
      { 
          if((bool)value) 
          { 
              DockingManager.SetState(d as DependencyObject, DockState.Float); 
          } 
          else 
          { 
              DockingManager.SetState(d as DependencyObject, DockState.Hidden); 
                 
          }            
       } 
} 
 
 
 
Also in the sample, we have changed the size of dock child window(ToolBox) in xaml and could not find the size changing issue. Can you please find the above video and let us know whether we missed any scenario in replicating the issue. 
Please download the code snippet, sample and video for the same from the above location.  
 
And we also checked the following “While setting IsHidden true / false in competitor product maintains the state (docked, pinned, floating, document...) here I have to remember this somehow”. By using the GetPreviousState method of DockingManager, you can get the previous state of respective dock child which was shown and hide using CheckBox. Please refer the above sample and video in which we have shown the dock child window(ToolBox) previous state in a button click event.  
 
Please try these solution and let us know if it was helpful.

 
Regards, 
Subashini M. 


ManniAT
Replied On February 12, 2019 08:03 PM UTC

Hi,

this somehow works - of course I have to save the state somehow before hiding - and later restore it to this.


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

Jagadeesan Pichaimuthu [Syncfusion]
Replied On February 13, 2019 09:48 AM UTC

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon