RadTabbedWindow as MainWindow

1 Answer 87 Views
TabbedWindow
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
Timothy J asked on 22 Nov 2022, 05:54 PM

In our app.xaml.cs we have been using this.MainWindow = new MyMainWindow().

We are trying to switch to a RadTabbedWindow, but RadTabbedWindow is not a Window, it is a UserControl.  What would be a way to use this and keep the this.MainWIndow?

WPF TabbedWindow - Getting Started - Telerik UI for WPF

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 24 Nov 2022, 11:13 AM

Hello Timothy,

Indeed, as the RadTabbedWindow class inherits from RadWindow (which is actually a HeaderedContentControl) it is not technically a Window and cannot be assigned as the MainWindow of the application.

What I can suggest instead would be to introduce an additional property of the App class:

	public partial class App : Application
	{
		public RadWindow MainTabbedWindow { get; set; }

		protected override void OnStartup(StartupEventArgs e)
		{
			this.MainTabbedWindow = new MyMainWindow();
                        this.MainTabbedWindow.Show();
			base.OnStartup(e);
		}
	}

You can then use this property throughout your application when needed:

var window = (App.Current as App).MainTabbedWindow;

Can you please give this a try and let me know if such an approach would work for you?

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 24 Nov 2022, 12:32 PM

Sure.  That could work.  Thanx.
Tags
TabbedWindow
Asked by
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dilyan Traykov
Telerik team
Share this question
or