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

RadWindow as MainWindow - RadWindow doesn't show up

4 Answers 653 Views
Window
This is a migrated thread and some comments may be shown as answers.
Anson
Top achievements
Rank 1
Anson asked on 30 Nov 2015, 05:04 AM
 <telerik:RadWindow
                x:Class="Testing.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                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="RadWindow" Height="1000.098" Width="1315.286"
    >

This is the MainWindow.xaml

 

- I have removed the StartUrl in app.xaml

- I have changed MainWindow: Window To MainWindow: RadWindow

protected override void OnStartup(StartupEventArgs e)
{
    new MainWindow().Show();
    base.OnStartup(e);
}
I have added this to app.xaml.cs

 *------

When I run the wpf, a exe is running( as i can see in task manager), but nothing show up.

 

This is driving me crazy. Any help would be appreciated

4 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 30 Nov 2015, 08:11 AM
Hi Anson,

If you are using Implicit Styles in order to style your application and apply some theme for it, please notice that the newly created user control (MainWindow that inherits RadWindow in your case) will not receive the default Style of RadWindow - that will cause the observed by you behavior of RadWindow.

So, in order to fix that you need to add the following Style after the merged dictionaries:
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Themes/System.Windows.xaml" />
            <ResourceDictionary Source="Themes/Telerik.Windows.Controls.xaml" />
            <ResourceDictionary Source="Themes/Telerik.Windows.Controls.Navigation.xaml" />
   
        </ResourceDictionary.MergedDictionaries>
<-- the TargetType should be your UserControl (MainWindow) that contains and inherits RadWindow -->
        <Style TargetType="local:MainWindow" BasedOn="{StaticResource RadWindowStyle}" />
   
    </ResourceDictionary>
</Application.Resources>

We suggest you to check the following article from our help documentation that provides detailed information how to use RadWindow as UserControl:
http://docs.telerik.com/devtools/wpf/controls/radwindow/how-to/use-radwindow-as-user-control

Please, give a try to the proposed above approach and let us know if it worked for you.

Hope this helps.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Alex
Top achievements
Rank 1
answered on 11 Jan 2018, 01:47 PM

When i am trying to open the window nothing is opening 

I have followed you above steps its shows this error message .

Cannot find resource named 'RadWindowStyle'. Resource names are case sensitive.

 

 

0
Alex
Top achievements
Rank 1
answered on 11 Jan 2018, 01:53 PM

Hi Nasko,

 

In App.xaml.cs i am loading the page like this 

  protected override void OnStartup(StartupEventArgs e)
        {
            new Main().Show();
            base.OnStartup(e);
        }

Please help with this issue.

0
Martin
Telerik team
answered on 12 Jan 2018, 08:16 AM
Hi,

You are receiving the xaml parse exception because you need to merge the Telerik.Windows.Controls.Navigation.xaml resource dictionary as well. Furthermore, after that you should remove the StartupUri from the App.xaml. You can check this article for more detailed steps (which  do not include the merging of the theme resources). I hope that this would solve the issue.

Regards,
Martin
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.
Tags
Window
Asked by
Anson
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Alex
Top achievements
Rank 1
Martin
Telerik team
Share this question
or