How to Use RadWindow as MainWindow
## Environment
Product Version | 2019.1.220 |
Product | RadWindow for WPF and Silverlight |
## Description
How to Use RadWindow as MainWindow.
## Solution
1. First open the MainWindow.xaml file and replace the Window declaration with a RadWindow declaration:
<h4><strong></strong></h4><div class='tabbedCode'><pre lang='XAML'><code> <telerik:RadWindow x:Class="RadWindowAsMainWindow.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" Header="MainWindow" Height="350" Width="525"> ... </telerik:RadWindow> </code></pre></div>
and in code-behind:
<h4><strong></strong></h4><div class='tabbedCode'><pre lang='C#'><code> public partial class MainWindow : RadWindow { ... } </code></pre></div>
2. Remove StartupUri from the Application definition inside App.xaml:
<h4><strong></strong></h4><div class='tabbedCode'><pre lang='XAML'><code> <Application x:Class="RadWindowAsMainWindow.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> ... </code></pre></div>
3. Then override the OnStartup method of the Application class to show the RadWindow:
<h4><strong></strong></h4><div class='tabbedCode'><pre lang='C#'><code> public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { new MainWindow().Show(); base.OnStartup(e); } } </code></pre></div>
## See Also