Where to put the XAML for the window?

14 posts, 1 answers
  1. SteveL
    SteveL avatar
    68 posts
    Member since:
    Apr 2009

    Posted 19 Aug 2009 Link to this post

    I've created a dialog box in XAML using a RadWindow, and I've just put the XAML into my main page, so it shows up in the design view in Visual Studio, hiding everything underneath it. Do you have any tips for a better way to do this?

    Steve
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 20 Aug 2009 Link to this post

    Hi Steve,

    If this is not a problem for you, it is ok to put the RadWindow control in your XAML. If you want to hide to be able to see what is behind, just set its visibility to collapsed (when you call its show method it will change its Visibility automatically).

    Just FYI, we recommend to inherit the window (like you do with the UserControl class when you create user controls, or with the WPF Window class).

    If you have further questions, don't hesitate to ask.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WPF is Visual Studio 2017 Ready
  4. SteveL
    SteveL avatar
    68 posts
    Member since:
    Apr 2009

    Posted 20 Aug 2009 Link to this post

    Setting the window's visibilty to collapsed has no effect for me (in the VS2008 designer).

    Could you explain what you mean about inheriting the window - none of the examples appear to do this?

    Steve
  5. Answer
    Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 21 Aug 2009 Link to this post

    Hi Steve,

    What you need to do is to create a UserControl, change the UserControl tag in the XAML file with telerikNavigation:RadWindow and change the new UserControl to not inherit from UserControl but from RadWindow. I've prepared a small example that demonstrates the idea.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  6. SteveL
    SteveL avatar
    68 posts
    Member since:
    Apr 2009

    Posted 23 Aug 2009 Link to this post

    Thanks, Miroslav, that makes it very clear.

    Steve
  7. Daniel Varrin
    Daniel Varrin avatar
    18 posts
    Member since:
    Oct 2009

    Posted 26 Nov 2009 Link to this post

    Hi,

    I don't really understand how to use the RadWindow.

    Can we use it as a normal WPF Window with a code behind?
    Can we use it as the application main window?

    Can the RadWindow tag be the first element of the XAML file or do we have to create a UserControl and put the RadWindow in it's content area?

    I also would like to create an opening animation for all my windows, as we can see on the Telerik demo application for WPF where the existing window is pushed to the left by the new window. Should I implement a new class inheriting from the RadWindow class or should I use "Attached Properties" or there is an other way?

    Thank you in advance for your help!

    Daniel
  8. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 26 Nov 2009 Link to this post

    Hello Daniel,

    Unfortunately you cannot use RadWindow as application root, because the WPF doesn't recognize it as a Window and doesn't show it correctly.

    Except this, you could use just like normal WPF window - inherit with XAML and add functionality and defaults in the new class and just use it from the other part of the application. You could use it in code behind and in XAML as well. We don't recommend placing RadWindow in XAML (if it is not the root tag), because in this case we need to remove it from the visual tree in order to show it correctly and this is not consider as a good thing. We've added this functionality to make it easier to customize with Blend for example.

    If you want to add functionality you could use both of the approaches - inheritance and attached behavior. If you need to add functionality to all of the windows in your application I would suggest you to inherit from the RadWindow control and use the inherited class. 

    If you have further questions, don't hesitate to ask.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Daniel Varrin
    Daniel Varrin avatar
    18 posts
    Member since:
    Oct 2009

    Posted 27 Nov 2009 Link to this post

    Thank you very much for your answer :-) Do you have a small sample XAML showing how to manually declare the namespace for the RadWindow? I don't understant where I have to put it.

    Daniel


  10. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 27 Nov 2009 Link to this post

    Hi Daniel,

    You could put it in the RadWindow tag. Please refer to the attached example.

    Here is the XAML:
    <telerikNavigation:RadWindow x:Class="RadWindowAsWindow.Window2"
        xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        Header="Window2" Height="300" Width="300">
        <Grid>
            <TextBlock Text="Rad Window!" />
        </Grid>
    </telerikNavigation:RadWindow>
    And code-behind:
    namespace RadWindowAsWindow
    {
        /// <summary>
        /// Interaction logic for Window2.xaml
        /// </summary>
        public partial class Window2 : RadWindow
        {
            public Window2()
            {
                InitializeComponent();
            }
        }
    }

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Daniel Varrin
    Daniel Varrin avatar
    18 posts
    Member since:
    Oct 2009

    Posted 27 Nov 2009 Link to this post

    Thank you Miroslav :-)

    I first thought the namespace had to be specified before we use the RadWindow tag.

    Best regards,
    Daniel
  12. RoxanaC
    RoxanaC avatar
    71 posts
    Member since:
    Dec 2009

    Posted 18 Dec 2009 Link to this post

    I was about to start a new thread about using RadWindow as a regular Application Window but I see that there are other people concerned about the same thing. This would be a great useful feature for RadControls for WPF! So please let me know if this will be available in the near future.
    Regards! RoxanaC
  13. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 19 Dec 2009 Link to this post

    Hello Roxana,

     I'm sorry. but I cannot understand what feature are you talking about. Could please describe in more details what feature do you think will be great to be added?

    Sincerely yours,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  14. RoxanaC
    RoxanaC avatar
    71 posts
    Member since:
    Dec 2009

    Posted 21 Dec 2009 Link to this post

    Sorry! Now I see that this post was kind of confusing.
    The feature would be - using RadWindow as application root
    (it was the question "Can we use it as the application main window?" that I wanted to ask)
    Thx!
  15. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 21 Dec 2009 Link to this post

    Hi Roxana,

     Now I understand. Unfortunately you cannot use the RadWindow control as application root, as it doesn't inherit from the WPF Window control and the WPF needs a Window as application root.

    Best wishes,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for WPF is Visual Studio 2017 Ready