Question

I want to use RadWindow as the main window of my WPF application. So that outer window also take the theme of overall application. I used this approach, but after that application is not being shown on Taskbar anymore. After reading different threads I came to know that because RadWindow is not child of Window so that's why its not possible.

So What is now I am trying to do, is to hide the outer Window completely somehow and to use RadWindow as a child, but parent of all other controls. Following is XAML

<Window x:Class="MyTest.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"
        WindowStyle="None"
        Title="MainWindow" >
    <telerik:RadWindow WindowStartupLocation="CenterScreen" Width="Auto" Height="Auto" x:Name="MyRadWindow">
    <Grid>
      <!-- All Controls here -->
    </Grid>
</telerik:RadWindow>
</Window>

But I am unable to completely hide the outer window. It still shows the borders. Then as a second step I have to handle the minimize, maximize and window close events from this RadWidow.

If anyone have tried this approach please help me out or suggest what would be the better way of doing this?

The main purpose of doing all this is to Sync the GUI of Outerwindow with the current TelerikTheme.

Was it helpful?

Solution

I think you should try to set main class as telerik window instead of nesting inside normal window:

<telerik:RadWindow x:Class="MyTest.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"
        WindowStyle="None" WindowStartupLocation="CenterScreen" ShowInTaskbar="True"
        Title="MainWindow" >
    <Grid>
      <!-- All Controls here -->
    </Grid>
</telerik:RadWindow>

Don't forget to change base class of MyTest.MainWindow to RadWindow

EDIT: Sorry didn't notice provided link. You can try hide main window with overriding it style by setting following attributes:

WindowStyle="None" Background="Transparent" AllowsTransparency ="True"

OTHER TIPS

There's a simpler solution using the RadWindowInteropHelper like this:

using Telerik.Windows.Controls.Navigation;
public partial class MyRadWindow : RadWindow
{
    public MyRadWindow()
    {
        InitializeComponent();
        RadWindowInteropHelper.SetShowInTaskbar(this, true);
    }
}
  1. First open the MainWindow.xaml file and replace the Window declaration with RadWindow declaration: <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" Loaded="RadWindow_Loaded_1" Header="MainWindow" Height="350" Width="525"> ... </telerik:RadWindow>

and in code-behind: `

public partial class MainWindow : RadWindow
    {
     ...
    }

2. Then override OnStartup method of the Application class to show the RadWindow:

public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            new MainWindow().Show();
            base.OnStartup(e);
        }
    }

`

  1. Then in RadWindowLoad event write this: `

    private void RadWindow_Loaded_1(object sender, RoutedEventArgs e) { var window = this.ParentOfType(); window.ShowInTaskbar = true; }

`

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top