Hello, I have got RadWindow created in xaml.
When I try to create this Rad window in code
var mainWindow = new MainWindow(); // IT'S RADWINDOW
Application.Current.MainWindow = mainWindow;
Close();
Application.Current.MainWindow.Show();
I have an error as:
Cannot implicitly convert type 'SomeProjectName.SomeFolder.MainWindow' to 'System.Windows.Window'
How to solve this problem?
When I try to create this Rad window in code
var mainWindow = new MainWindow(); // IT'S RADWINDOW
Application.Current.MainWindow = mainWindow;
Close();
Application.Current.MainWindow.Show();
I have an error as:
Cannot implicitly convert type 'SomeProjectName.SomeFolder.MainWindow' to 'System.Windows.Window'
How to solve this problem?
10 Answers, 1 is accepted
0
Accepted
Hello Sergiy,
Please check the following kb article which demonstrates how you can use RadWindow as main Window in WPF:
http://www.telerik.com/support/kb/wpf/window/radwindow-as-main-window.aspx
Also the approach is discussed in details in the following forum thread:
http://www.telerik.com/community/forums/wpf/window/radwindow-as-mainwindow.aspx
Kind regards,
Yana
the Telerik team
Please check the following kb article which demonstrates how you can use RadWindow as main Window in WPF:
http://www.telerik.com/support/kb/wpf/window/radwindow-as-main-window.aspx
Also the approach is discussed in details in the following forum thread:
http://www.telerik.com/community/forums/wpf/window/radwindow-as-mainwindow.aspx
Kind regards,
Yana
the Telerik team
Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.
0
Ron
Top achievements
Rank 1
answered on 13 Dec 2012, 03:17 PM
I'm having the same issue. The RadWindow cannot be used as a typical Window object. These referenced links only show how to set up the RadWindow, not how to use the RadWindow as a Window object in the code-behind. Can someone please answer how to use the RadWindow as a Window object in the code-behind?
0
Hi Ron,
Currently this is the only way to use RadWindow as main Window that we provide. Could you please explain in more details the issues you're experiencing with the approach?
Regards,
Yana
the Telerik team
Currently this is the only way to use RadWindow as main Window that we provide. Could you please explain in more details the issues you're experiencing with the approach?
Regards,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Anatoliy
Top achievements
Rank 2
answered on 11 Feb 2013, 09:55 AM
I have the same Exception with using WPF + MEF... RadWindow can't be converted in Bootstraper:
Waiting for some advises!
Best regards, Anatoliy
protected
override
void
InitializeShell()
{
base
.InitializeShell();
Application.Current.MainWindow = (Window) Shell;
Application.Current.MainWindow.Show();
}
Waiting for some advises!
Best regards, Anatoliy
0
Sueleyman
Top achievements
Rank 1
answered on 13 Nov 2015, 10:47 AM
Hi Anatoliy,
did you find a soultion for this ?
0
Hello Sueleyman,
Please find attached a sample project demonstrating how to use RadWindow as MainWindow in a PRISM 5 application.
Hope this helps.
Regards,
Kalin
Telerik
Please find attached a sample project demonstrating how to use RadWindow as MainWindow in a PRISM 5 application.
Hope this helps.
Regards,
Kalin
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
Jason
Top achievements
Rank 1
answered on 24 May 2018, 09:10 PM
Has anyone found a solution for this? I'm having a lot of trouble setting the parent Window of my RadWindow since I can't get it to recognize the RadWindow as a System.Windows.Window.
0
Jason
Top achievements
Rank 1
answered on 25 May 2018, 03:26 PM
To elaborate further, the issue is that while Telerik says that RadWindow is a "Window" object, it's not entirely accurate, since RadWindow does not inherit the System.Windows.Window class, instead it inherits System.Windows.WindowBase, which means that if you try and pass a RadWindow to functions like the WPF / Win32 interoperability helper System.Windows.Interop.WindowInteropHelper it fails because the WindowInteropHelper expects an object of the "Window" class, not "WindowBase".
So is there a way of getting a RadWindow as a System.Windows.Window object?
So is there a way of getting a RadWindow as a System.Windows.Window object?
1
Hi Jason,
RadWindow is hosted in transparent WPF Window. You could get the host Window at run time as shown below:
If you need it before it is shown, you could use the HostCreated event of RadWindow - you will be able to find the WPF Window instance in the event arguments.
Hope this helps.
Regards,
Kalin
Progress Telerik
RadWindow is hosted in transparent WPF Window. You could get the host Window at run time as shown below:
var wpfWindow = Window.GetWindow(radWindow);
If you need it before it is shown, you could use the HostCreated event of RadWindow - you will be able to find the WPF Window instance in the event arguments.
Hope this helps.
Regards,
Kalin
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.
1
Jason
Top achievements
Rank 1
answered on 28 May 2018, 04:03 PM
Thank you a ton Kalin! That solved it for me. Had to use the hostcreated event, but from there I could set my radWindow's owner using the interop helper. Cheers!