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

Where to put the XAML for the window?

13 Answers 181 Views
Window
This is a migrated thread and some comments may be shown as answers.
SteveL
Top achievements
Rank 2
SteveL asked on 19 Aug 2009, 10:15 AM
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

13 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 20 Aug 2009, 12:29 PM
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.
0
SteveL
Top achievements
Rank 2
answered on 20 Aug 2009, 02:34 PM
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
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 21 Aug 2009, 08:55 PM
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.
0
SteveL
Top achievements
Rank 2
answered on 23 Aug 2009, 05:04 PM
Thanks, Miroslav, that makes it very clear.

Steve
0
Daniel Varrin
Top achievements
Rank 1
answered on 26 Nov 2009, 02:44 PM
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
0
Miroslav Nedyalkov
Telerik team
answered on 26 Nov 2009, 04:45 PM
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.
0
Daniel Varrin
Top achievements
Rank 1
answered on 27 Nov 2009, 08:26 AM
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


0
Miroslav Nedyalkov
Telerik team
answered on 27 Nov 2009, 08:57 AM
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.
0
Daniel Varrin
Top achievements
Rank 1
answered on 27 Nov 2009, 09:45 AM
Thank you Miroslav :-)

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

Best regards,
Daniel
0
RoxanaC
Top achievements
Rank 1
answered on 18 Dec 2009, 09:15 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 19 Dec 2009, 01:46 PM
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.
0
RoxanaC
Top achievements
Rank 1
answered on 21 Dec 2009, 06:46 AM
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!
0
Miroslav Nedyalkov
Telerik team
answered on 21 Dec 2009, 09:58 AM
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.
Tags
Window
Asked by
SteveL
Top achievements
Rank 2
Answers by
Miroslav Nedyalkov
Telerik team
SteveL
Top achievements
Rank 2
Daniel Varrin
Top achievements
Rank 1
RoxanaC
Top achievements
Rank 1
Share this question
or