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

RadDocking.GetFloatingWindowState() returns normal state while RadPane is in maximized state

9 Answers 112 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Tayyaba
Top achievements
Rank 1
Tayyaba asked on 08 May 2018, 12:33 PM

Hi,

I'm using RadDocking.GetFloatingWindowState(myRadDocumentPane) method on my floating documentPane. I have maximzied floating window by double clicking on its header, and then checked still this method returns "Normal state"  result.

 

I need to find out if my floating window is in maximized state or not.

 

Thanks,

Tayyaba

9 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 11 May 2018, 11:26 AM
Hello Tayyaba,

In order to check whether a RadDocumentPane is in a maximized ToolWindow, you can check its WindowState property. You can find the ToolWindow that the pane is hosted in with the ParentOfType extension method. Here is how that would look:
var toolWindow = this.docPane.ParentOfType<ToolWindow>();
 
if(toolWindow != null)
{
    var state = toolWindow.WindowState;
}

Please note that "this.docPane" refers to the RadDocumentPane instance that you want to check.

Hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Tayyaba
Top achievements
Rank 1
answered on 11 May 2018, 11:43 AM

Hi Vladimir,

 

Thank you for helping me out, it worked.
But I also wanted to know how can I maximize my floating RadDocumentPane programmatically?

Thanks,

0
Vladimir Stoyanov
Telerik team
answered on 16 May 2018, 09:01 AM
Hello Tayyaba,

You should be able to set the window state in a similar manner: 
var toolWindow = this.docPane.ParentOfType<ToolWindow>();
 
if(toolWindow != null)
{
    toolWindow.WindowState = WindowState.Maximized;
}

Please give this a try and let me know if it works for you.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Tayyaba
Top achievements
Rank 1
answered on 16 May 2018, 10:41 AM

Hi Vladimir

I have already tried the exact same thing, but it didn't work.

 

Regards,

Tayyaba

0
Vladimir Stoyanov
Telerik team
answered on 16 May 2018, 03:02 PM
Hello Tayyaba,

I am attaching a sample project demonstrating the approach I suggested. May I ask you to check it out and see how it differs from the setup at your end? 

Should you need any further assistance, can you share what you are doing differently on your side?

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Tayyaba
Top achievements
Rank 1
answered on 17 May 2018, 04:55 AM

Hi Vladimir,

 

Your solution is working perfectly fine, and i've also found out why this same code isn't working on my side.
Actually I want to maximize my floating window whenever the main window is restored from minimized state, i've tried to do this same thing in your sample project as well, but now it is not working in that too. I think it is not working because the code gets executed while the window is still in minimized state.

I'm attaching the MainWindow.xaml.cs file which I have modified for the same project.

Please let me know, what can be done to make this scenario work for me.

 

Thanks.

Tayyaba

0
Tayyaba
Top achievements
Rank 1
answered on 17 May 2018, 04:58 AM

I was having some issue with attaching the project and file.
Here's the MianWindow.xaml.cs file code i missed to attached in my previous reply.

 

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.StateChanged += MainWindow_StateChanged;
        }
 
        private void MainWindow_StateChanged(object sender, System.EventArgs e)
        {
            if (this.WindowState == WindowState.Maximized || this.WindowState == WindowState.Normal)
            {
                var toolWindow = this.docPane.ParentOfType<ToolWindow>();
 
                if (toolWindow != null)
                {
                    toolWindow.WindowState = WindowState.Maximized;
                }
            }
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var toolWindow = this.docPane.ParentOfType<ToolWindow>();
 
            if(toolWindow != null)
            {
                toolWindow.WindowState = WindowState.Maximized;
            }
        }
    }
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 21 May 2018, 11:07 AM
Hello Tayyaba,

Thank you for the provided code snippet. Our forum system allows adding only image files. If you want to send us a .zip file with the project that demonstrates the issue you can open a new support ticket from your telerik.com account. 

What I can suggest you in your case is to delay the setting of the WindowState property of the ToolWindow. Check the following code snippet.

private void Window_StateChanged(object sender, System.EventArgs e)
{
    if (this.WindowState == WindowState.Maximized || this.WindowState == WindowState.Normal)
    {
        var toolWindow = this.docPane.ParentOfType<ToolWindow>();
 
        if (toolWindow != null)
        {
            Dispatcher.BeginInvoke((Action)(() =>
            {
                toolWindow.WindowState = WindowState.Maximized;
            }));
        }
    }
}

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Tayyaba
Top achievements
Rank 1
answered on 22 May 2018, 04:25 AM

Hi Dinko,

Thank you so much for helping me out, it worked perfectly.

 

Regards,
Tayyaba

Tags
Docking
Asked by
Tayyaba
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Tayyaba
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or