RadWindow as MainWindow

37 posts, 0 answers
  1. Narendra
    Narendra avatar
    1 posts
    Member since:
    Dec 2010

    Posted 16 Nov 2011 Link to this post

    After reading numerous solutions on this forum and the inability to use RadWindow as a regular window, I started experimenting with RadWindow and was able to consolidate some of the solutions in this forum and create a simple example which will enable RadWindow to be used as any other window. Following code example is self explanatory and should give you a starting point.

     

    public partial class MainWindow : RadWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            RadWindowHelper windowHelper = new RadWindowHelper();
            windowHelper.TaskBarDisplayed += new EventHandler(windowHelper_TaskBarDisplayed);
            windowHelper.ShowWindowInTaskBar();
        }
      
        void windowHelper_TaskBarDisplayed(object sender, EventArgs e)
        {
            this.Show();
            this.WindowState = WindowState.Maximized;
            this.BringToFront();
            var window = this.ParentOfType<Window>();
            window.ShowInTaskbar = true;
            window.Title = "My RadWindow";
        }
    }
      
      
    public class RadWindowHelper
    {
         public event EventHandler TaskBarDisplayed;
                
         public void ShowWindowInTaskBar()
         {
             if (this.TaskBarDisplayed != null)
                this.TaskBarDisplayed(this, new EventArgs());
         }
    }

  2. Mike
    Mike avatar
    26 posts
    Member since:
    Jun 2008

    Posted 21 Nov 2011 Link to this post

    Narendra,

    many thanks for your post! We have the same problem here which has not being addressed by Telerik so far. I mean, why should someone use RadWindow when he can't use the same style on the MainWindow?

    Mike







  3. UI for WPF is Visual Studio 2017 Ready
  4. Mangesh
    Mangesh avatar
    16 posts
    Member since:
    Sep 2011

    Posted 12 Mar 2012 Link to this post

    hi,

    I'm not able to use Radwindow as MainWindow in one of my wpf projects. Can you please review it?
    Here is the error code :
    RadWindow control needs to be displayed using its Show or ShowDialog method and shouldn't be added to the layout.

    How to use it as MainWindow then ?

    Regards
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 12 Mar 2012 Link to this post

    Hello,

    We've just added a new kb article showing how you can use RadWindow as a main Window. Please check it at the following link:
    http://www.telerik.com/support/kb/wpf/window/radwindow-as-main-window.aspx

    Greetings,
    Yana
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Jean Ressouche
    Jean Ressouche avatar
    81 posts
    Member since:
    Aug 2012

    Posted 18 Mar 2012 Link to this post

    Hi, nice article but is it possible to get a way to have the application in the windows task bar ? Under the trial version i got, thats is not possible. Without that, have a RadWindow as MainWindow seems unusable... 

    [Edit] Forget my post, Narendra did respond to it perfectly.
  7. Grzesiek
    Grzesiek avatar
    87 posts
    Member since:
    Jun 2007

    Posted 24 Mar 2012 Link to this post

    Hi!

    I'm getting the same error as mangesh.
    I followed by KB's article, but can't make my RadWindow to work. I rewrite MainWindow to be RadWindow and I'm getting an error.

    ====== EDIT ======  
    I found the problem - I had specify StartupUri in App.xaml. After delete it, everything works fine.

    My question is - I have welcome window (simple window.xaml). After few seconds of show it, I have:

    void FadeOutAnim_Completed(object sender, EventArgs e)
           {
               MainWindow main = new MainWindow();
               main.Show();
               this.Close();
           }

    So I don't have  "base.OnStartup(e);" - it's OK? I won't have any problems in future?
  8. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 27 Mar 2012 Link to this post

    Hi Grzesiek,

    We're glad that you've managed to resolve the issue, the code you've provided seems ok.

    Kind regards,
    Yana
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  9. Chris
    Chris avatar
    10 posts
    Member since:
    Dec 2011

    Posted 27 Jul 2012 Link to this post

    HI,

    I've used a much smaller competitor's controls happily for a number of years until I recently had a need they couldn't fill.  I now use Telerik's controls alongside these other controls and have been very pleased with the Telerik's offerings...with one important exception, as highlighted in this thread.

    Like most developers, I desire to be able to style all my windows similarly.  This includes the Main Window.  As stated by Mike in his post "why should someone use a RadWindow when he can't use the same style on the MainWindow".  This is basic stuff.  The competitor offers a RibbonWindow that can easily be used outside of the ribbon as a direct replacement for the WPF Window.  I can indicate a particular style/theme for my MainWindow, as well as other child windows as a simple drop-in for the WPF Window control.

    In this thread, Narendra offers some solid code for overcoming Jean Ressouche's objection about not being able to view the window in the taskbar.  My need for a Closing event was simply solved by grabbing RabWindow's parent Window control.  After all of this, however, when the user hovers over the taskbar icon, instead of the window temporarily displaying, a small minimized nib shows in place of the RadWindow.  This was the (last) show-stopper.

    In one of my current projects, I have to and am glad to use *only* Telerik controls, but on this issue, I am out of solutions and workarounds and am taking an additional 30 minutes (in addition to the three hours I've wasted trying to come up with a workable solution) to ask you guys to seriously re-consider a real alternative to this issue.  You have smart people and lead the market.  Please provide a solid solution to developers who desire a WPF Window replacement that is theme-aware (like RadWindow) that can be used for the Main Window of a WPF application, display in the taskbar, have a Closing event and display the actual window when the user hovers over the taskbar popup for this application.

    Thanks very much,

    Chris A
  10. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 01 Aug 2012 Link to this post

    Hello Chris,

    Actually there is already a way to show RadWindow in the TaskBar - just set RadWindowInteropHelper.ShowInTaskbar property:

    <telerik:RadWindow x:Class="RadWindowAsMainWindow.MainWindow"
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  
            xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
            navigation:RadWindowInteropHelper.ShowInTaskbar="True"
            Header="MainWindow" Height="350" Width="525">
        <Grid>
            ...
        </Grid>
    </telerik:RadWindow>

    Note that this will work in the latest versions of RadControls.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Chris
    Chris avatar
    10 posts
    Member since:
    Dec 2011

    Posted 05 Aug 2012 Link to this post

    Hi Yana,

    Thanks for the response. While I successfully incorporated the RadWindowInteropHelper.ShowInTaskBar into my code, I'm afraid it left me in the same state as before.  Recall that I mentioned that Narendra provided a solution to the "not able to show in the Task Bar" problem. 

    While your solution is easy and shorter, it didn't address the biggest issue.  In my previous post, I said " After all of this, however, when the user hovers over the taskbar icon, instead of the window temporarily displaying, a small minimized nib shows in place of the RadWindow.  This was the (last) show-stopper".

    I've attached two screenshots that, hopefully, will make the problem more clear.

    The first screenshot (radwindow_appfullsize.png) shows the use of a RadWindow as the MainWindow (per the code offered by others in this post), that employs the RadWindowInteropHelper.ShowInTaskBar code you mentioned.  As you can see, the RadWindow indeed displays as the Main Window and shows up in the TaskBar.

    The second screenshot (radwindow_appminimized.png) displays what happens when the app is minimized. It still shows up in the TaskBar. However, when you hover over the TaskBar, two problems occur:  
        1) Instead of displaying a thumbnail view of the app in the small popup windows that appears when one hovers over a TaskBar item, the thumbnail displays only the upper left nib of the actual window.
        2) The problem in 1) above occurs because all that is displayed when one hovers over the thumbnail is the upper left of the app.

    This problem highlights the fact that the basic behavior of a RadWindow when minimized is to reduce itself to a small nib.

    And all of this goes back to the main point of my last post; that Telerik needs to provide a true replacement for the MainWindow that matches the RadWindow chrome.  Again, as has been said by others, why would I want to use a RadWindow for every window in my app except the Main Window?

    If you can provide a solution to this issue, I can get by with all of the other workarounds supplied in this post to achieve my objective of having the same window chrome for all my windows (especially MainWindow).  Otherwise, I will have to forego the use of RadWindow anywhere in my app.

    Thanks in advance for your response,

    Chris A
  12. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 08 Aug 2012 Link to this post

    Hi, we recently bought telerik controls, and started replacing all third party ones with telerik ones. But we incorporated with the same problem, we cannot use radwindow if it causes issue as main window. And workarounds for using rad window have no sense. We won't spend time to create workarounds on working project now. We would like simply replace our window base class (used as custom window, with all theming and actions) with telerik window. But until this will be possible we cannot. I hope telerik will create solution quite soon.
  13. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 09 Aug 2012 Link to this post

    Hello,

    Actually we have tried to provide a simpler way to use RadWindow as MainWindow by creating RadWindowInteropHelper. If there are some issues with it or its properties (as ShowInTaskbar) we need to reproduce them at our side first and then provide a fix.

    I've tested again the project, but wasn't able to reproduce the issue with the thumbnail view, please check the attached screenshot for a reference. I've noticed that you are using Windows 8 Release Preview, is it possible for you to check this in Windows 7 as well?  We also tested Windows 8 Developer Preview. but still did not manage to observe the problem.  Any additional information you could  provide on this issue will be of great help.

    Looking forward to your reply.


    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  14. Chris
    Chris avatar
    10 posts
    Member since:
    Dec 2011

    Posted 12 Aug 2012 Link to this post

    Hi Yana,

    Thanks for the response.  I'm afraid I'm not easily able to test this on Windows 7.  However, how about if you simply post the code (or the entire solution in a ZIP file) you used to display the screenshot you attached to your last email and let me try it?  Also, you've mentioned the RadWindowInteropHelper a couple of times.  Might you also be able to provide a link that describes what problems this helper is intended to overcome and how to use it?  While I've used it to implement the TaskBar display, it seems like it would be helpful for me to know its full capability.

    Sincerely,

    Chris A
  15. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 14 Aug 2012 Link to this post

    Hello Chris,

    I have attached the test project, please download it and give it a try.

    As to the RadWindowInteropHelper - we haven't prepared a more detailed documentation yet, but you can check its properties in the API Reference:
    http://www.telerik.com/help/wpf/t_telerik_windows_controls_navigation_radwindowinterophelper.html
    http://www.telerik.com/help/wpf/allmembers_t_telerik_windows_controls_navigation_radwindowinterophelper.html

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  16. Chris
    Chris avatar
    10 posts
    Member since:
    Dec 2011

    Posted 14 Aug 2012 Link to this post

    Hi Yana,

    I tried it and, sorry, no go.  It seems that the screenshot you sent me was one where you had not minimized the RadWindow (the main point of my posts).  Your sample exhibits the exact problems I described and showed in the images I attached to my prior post.  I have attached a screenshot of your app (with no code modification whatsoever) in its minimzed state, hovering over its TaskBar thumbnail). Therefore, it appears that the RadWindow indeed *cannot* be used as the MainWindow.  Please refer again to the images I attached to my prior post.

    When you minimize the MainWindow of the sample you sent (where it only is shown in the TaskBar) and then hover over the TaskBar icon, you will see a minimized picture in the thumbnail (which is unacceptable).  If you then hover over the thumbnail itself, you will only see a nib on the screen (which is doubly unacceptable). At this point, I've described the problem in detail, sent before and after screenshots, run the code you've sent and confirmed that your app has the same issue as my app.  I don't know what else I can do but forego the use of the RadWindow because (for anyone else that reads this post) when you minimize the RadWindow used as the MainWindow, hovering over its thumbnail from the TaskBar will display NOT the screen you expect, but a small nib (as shown in my attached images).

    I truly appreciate your time spent thus far but, at this point, I would ask that you go back to my very first post, which is addressed to the higher-ups at Telerik asking them to please provide a theme-aware window that can be used as a MainWindow (as do a number of your smaller competitors).  This is a gapping hole in an otherwise excellent set of tools/controls.

    Sincerely,

    Chris A
  17. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 15 Aug 2012 Link to this post

    Hello Chris,

    Let me introduce myself - I'm the lead of the team responsible for the RadWindow control.

    We investigated your issue further and were able to reproduce it on a real device with the Windows 8 Consumer preview installed on it. As it seems that this behavior changes from release of windows to another release we will wait for the official release of Windows 8 and target the problem if exists there.

    Please accept our apologize for the inconvenience caused.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  18. Chris
    Chris avatar
    10 posts
    Member since:
    Dec 2011

    Posted 15 Aug 2012 Link to this post

    Hi Miroslav,

    I recognize your name from a number of posts over the past 3-4 years regarding this same issue.  Thanks very much for testing and responding.  For what it's worth, I've experienced this problem on Windows 8 Release Preview running on the same Samsung Series Seven Slate distributed to attendees at last year's Microsoft Build conference.  However, given that today Windows 8 RTM will be released to MSDN Subscribers, I will be able to test Yana's code this weekend after I install it.  I'll let you know of my results.

    Sincerely,

    Chris A
  19. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 03 Sep 2012 Link to this post

    Thanks for solution. I have it almost working, but have one issue. I need to set manually MainWindow in app on startup. But I cannot assign rad window. How can I get to Window for that rad window?
  20. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 04 Sep 2012 Link to this post

    Hello Marcin,

    You don't need to assign the RadWindow to be the main window of your app - if it is opened first it becomes the main window automatically. If you need to find the WPF window of the RadWindow for any other reason you just need to call the Window.GetWindow(radWindow) once the RadWindow called radWindow is opened and the result will be the hosting WPF Window control.

    All the best,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  21. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 04 Sep 2012 Link to this post

    Thank you, that is working. I know that is assigned autoamlically, but I'm having splash screen which is displayed first then closed, so I had to assign proper main window later.
  22. Igor
    Igor avatar
    26 posts
    Member since:
    Nov 2010

    Posted 10 Sep 2012 Link to this post

    Hello,
    The RadWindow as MainWindow is working now, but how about setting the RadWindow  Icon in the taskbar? The visual studio project icon is not working (I am using window xp).

    Best regards.
    Igor 
  23. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 10 Sep 2012 Link to this post

    Eg:

    navigation:RadWindowInteropHelper.ShowInTaskbar="True" navigation:RadWindowInteropHelper.Icon="/MyApp;component/App.ico"   navigation:RadWindowInteropHelper.Title="My App"
  24. Igor
    Igor avatar
    26 posts
    Member since:
    Nov 2010

    Posted 10 Sep 2012 Link to this post

    Great! Thank you.
  25. Mirco
    Mirco avatar
    2 posts
    Member since:
    Sep 2012

    Posted 04 Oct 2012 Link to this post

    Complete reference in order to get the icon showing in the taskbar:

    1) add the project a reference to:
    Telerik.Windows.Controls.Navigation.dll

    2) add the icon file (eg: iconFileName.ico) to the VisualStudio project, in the main folder
    I have also actually set it as the assembly icon in the Application tab in the VisualStudio property window.

    3) insert in the RadWindow the following:

       xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
        navigation:RadWindowInteropHelper.ShowInTaskbar="True"
        navigation:RadWindowInteropHelper.Icon="/assemblyName;component/iconFileName.ico"

    so the RadWindowInteropHelper.Icon syntax shoud be: "/XXX;component/YYY"
    where XXX is the assembly name and YYY is the iconFileName with extension.

    Hope this might help
    cheers ya'all




  26. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 04 Oct 2012 Link to this post

    Is it possible to RadWindow be visible by other (extenal) approlaction as normal window e.g. by display fussion to add mutimonitor button support? E.g. Elysium window is visible : http://elysium.codeplex.com/ but rad window not.
  27. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 09 Oct 2012 Link to this post

    Hello Marcin,

    Could you please explain in more details the requirement? Thanks

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  28. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 11 Oct 2012 Link to this post

    I've attached 2 files:
    1. RadWindow
    2. Elysium theme one

    Elysium is working in the same way as Visual Studio 2012 and making window visible for othe appliations - in this case Display Fusion (mutimonitor application)

    But Rad Window is working in "normal"  way with None window style, which is usualy enough, but not when you want normal window behavior with just different view.
  29. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 21 Oct 2012 Link to this post

    Hello,
    I'm trying to use a RadWindow as a main window, using RadControls Q3 2012 and I found a big problem: if I minimize the window, then click on the taskbar icon, I only see the window header.I had to manually increase the size of the window to have its content visible.

    EDIT:
    This behavior is if we leave the WindowStartUpLocation property to its default value: Manual, without setting a size.
    If the property has another value, it works correctly.

    EDIT 2:
    Worse: even with setting WindowStartUpLocation to CenterScreen, I sometimes have the same behavior.

    Patrick
  30. Patrick
    Patrick avatar
    372 posts
    Member since:
    Aug 2012

    Posted 21 Oct 2012 Link to this post

    Hello,
    another problem when using RadWindow as a main window: if I use implicit styles for the themes and change the theme, not all all the window border and title is changed.
    For example, look at the screen shot, after starting the application with Expression_Dark theme and changing to Windows8 theme.

    SOLUTION:
    You must set the style of the window using a DynamicResource and not a StaticResource:
    Style="{DynamicResource RadWindowStyle}"

    Patrick
  31. s_guryev
    s_guryev avatar
    5 posts
    Member since:
    Oct 2012

    Posted 28 Oct 2012 Link to this post

    Hi Yana.

    I think that adding this workaround with removing the StartupUri in the App.xaml to starting RadWindow as a MainWindow without IE window wrapping to the KB http://www.telerik.com/support/kb/wpf/window/radwindow-as-main-window.aspx would be a VERY GOOD idea. I have spent about 10 minutes to solve this problem. It means, that steps described in this KB doesn't FULLY solved problem with RadWindow as MainWindow.

    Thank you!
Back to Top
UI for WPF is Visual Studio 2017 Ready