Hide RadWindow

8 posts, 1 answers
  1. Alexandre
    Alexandre avatar
    2 posts
    Member since:
    Sep 2013

    Posted 25 Dec 2018 Link to this post

    Hi,

    I need to hide a RadWindow completely and have tried multiple ways but they do not give the expected result. In fact, I have tried minimizing the window and hiding the icon from the taskbar (but I haven't found such a method in the documentation), or setting the visibility to Hidden but none of those completely hide the Window. How is it possible to hide a window, other than by closing it?

    Kind regards,

    Alexandre

  2. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 26 Dec 2018 Link to this post

    Hello Alexandre,

    The easiest approach to acheive your requirement might be setting the Width and Height of the window to 0. I've attached a small example showing this approach. Can you check it out and let me know if it helps?

    Regards,
    Martin Ivanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Alexandre
    Alexandre avatar
    2 posts
    Member since:
    Sep 2013

    Posted 27 Dec 2018 in reply to Martin Ivanov Link to this post

    Hello,

    I have solved the problem by using this:

    1.var window = Window.GetWindow(form);
    2.window.ShowInTaskBar = false;
    3.window.WindowState = WindowState.Minimized;

     

    Thank you nonetheless for the solution you have suggested.

    Regards,

    Alexandre

  4. Avrohom Yisroel
    Avrohom Yisroel avatar
    50 posts
    Member since:
    Jan 2011

    Posted 09 Sep in reply to Martin Ivanov Link to this post

    I've come accross this thread as I changed my window to a RadWindow and now the Hide() method no longer works. I downloaded your sample show-hide-window.zip which doesn't do as described. There is a main window which is not a RadWindow, with no other files that open or close the window. There isn't anywhere in the project that hides the window.

    Also, is this the only way? When I tried it in my solution, the window went visibley smaller so there was just the title bar left, then just showed that small bit blurred out. This is not at all professional looking. I also used the Visibility to collapsed which didn't do anything.

    RadWindowInteropHelper.SetShowInTaskbar(this, false);
    Height = 0;
    Width = 0;
    Visibility = Visibility.Collapsed;

    Please advise,
    Many thanks.

  5. Avrohom Yisroel
    Avrohom Yisroel avatar
    50 posts
    Member since:
    Jan 2011

    Posted 09 Sep in reply to Avrohom Yisroel Link to this post

    Whoops, forgot to add the screenshot I took to show.
  6. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 11 Sep Link to this post

    Hello Avrohom,

    It seems that I've attached the wrong project. Anyway, here is another approach that is a bit more convenient. Basically, you can get the host Window control and call its Hide() method. Here is an example in code:

    private void HideWindow()
    {
    	var hostWindow = this.radWindow.ParentOfType<Window>();
    	RadWindowInteropHelper.SetShowInTaskbar(this, false);
    	hostWindow.Hide();
    }

    I also attached a sample project showing this approach. I hope it helps.

    Regards,
    Martin Ivanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Avrohom Yisroel
    Avrohom Yisroel avatar
    50 posts
    Member since:
    Jan 2011

    Posted 17 Sep in reply to Martin Ivanov Link to this post

    Hi Martin Ivanov,

    This works perfectly. In my case I was trying to hide the window that was calling the Hide method, so I could replace:

    var hostWindow = this.radWindow.ParentOfType<Window>();

    with:

    var hostWindow = this.ParentOfType<Window>();

    Thank you.

    P.s. Just out of interest, why does all the code from Telerik use

    this.radWindow.ParentOfType

     rather than just

    radWindow.ParentOfType

    ??

  8. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 18 Sep Link to this post

    Hello Avrohom,

    It is good to hear that my suggestion was helpful.

    As for why the code snippets use "this.radWindow" instead of "this", that is because RadWindow us often used in code. Something like this:

    private RadWindow radWindow = new RadWindow();

    private void ShowRadWindow()
    {
    this.radWindow.Content = new MyUserControl();
    this.radWindow.Show():
    }

    Regards,
    Martin Ivanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top