Telerik UI for WPF in R2 2019 is here and I am happy to announce that it can help you take the navigation in your WPF application to the next level. Say hi to the latest addition to our collection of WPF navigation controls – the brand new RadTabbedWindow.
It may sound like a hybrid WPF control, born from the equation RadTabControl + RadWindow = RadTabbedWindow. Don’t worry, RadTabbedWindow is not like hybrid cars – this control is the best of both worlds and there are no two ways about it.
Any application deserves an efficient navigation system. Luckily, tabbed navigation is one good such system. Tabbed navigation can absolutely be described as a “good conversation” with your clients. If implemented properly, it clearly and precisely tells the users exactly:
Therefore, a good navigation system needs to meaningfully separate content into different sections, clearly show what content is available and interactively present that content.
Want to bring the productivity of tabbed window management to your WPF application? Let me guide you through its key features.
The control has a rich API that greatly facilitates the customization of its functionality and appearance. Some of the tabbed window's key features include:
Oh, let’s not forget to mention that the RadTabbedWindow control also exposes a number of events that greatly contribute to the easy customization of the control’s behavior:
More detailed information can be found in the great documentation article for the control.
P.S. The tabbed window comes with the built-in variety of our Telerik UI for WPF Themes Suite (this means even easier look and feel enhancements). Also, do not hesitate to benefit from the flawless color customization and rapid palette creation using the Color Theme Generator. Now let’s move on to the interesting part! The next sections will guide you through embedding UWP’s WebView control inside RadTabbedWindow.
Do you remember XAML Islands? They are like little containers inside WPF apps - ones that can hold little pieces of XAML to render UWP controls. This way, we can now bring an even richer app experience with the modern UWP WebView control within our tabbed window.
With the newer Windows 10 versions, you can host UWP controls in non-UWP desktop applications using this feature. More information on this can be found here.
Have you already tried them? Shame on me, I haven’t.
What better time than now to test the waters of XAML Islands? :)
There are some requirements that you need to be sure are met before we proceed:
Once we have check marks next to all the above bullets, we are ready to drag the WebView control from Visual Studio’s Toolbox!
In this guide, I am using the tabbed window with NoXaml version and the Fluent theme.
Add an empty Style targeting the main window which is based on RadTabbedWindowStyle. Your App.xaml should look like:
<
Application.Resources
>
<
ResourceDictionary
>
<
ResourceDictionary.MergedDictionaries
>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.Navigation.xaml"
/>
</
ResourceDictionary.MergedDictionaries
>
<
Style
TargetType
=
"local:MainWindow"
BasedOn
=
"{StaticResource RadTabbedWindowStyle}"
/>
</
ResourceDictionary
>
</
Application.Resources
>
<
telerik:RadTabbedWindow
x:Class
=
"WpfApplication1.MainWindow"
xmlns:local
=
"clr-namespace:WpfApplication1"
mc:Ignorable
=
"d"
Header
=
"MainWindow"
Height
=
"800"
Width
=
"1300"
>
</
telerik:RadTabbedWindow
>
To be able to show WebView as RadTabbedWindow’s Content you need to add the following namespace and set AllowTransparency property to false. This property is true by default because of the underlying shadow, present in all themes.
xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
navigation:RadWindowInteropHelper.AllowTransparency="False"
In MainWindow.xaml.cs, you should inherit from RadTabbedWindow instead of Window:
public
partial
class
MainWindow : RadTabbedWindow
{
public
MainWindow()
{
InitializeComponent();
}
}
protected
override
void
OnStartup(StartupEventArgs e)
{
new
MainWindow().Show();
base
.OnStartup(e);
}
Otherwise - you can create it as a separate window by adding a new Window to your project and changing the TargetType of the empty style from step 1 accordingly.
private void RadTabbedWindow_AddingNewTab(object sender, Telerik.Windows.Controls.TabbedWindow.AddingNewTabEventArgs e)
{
var wv = new WebView();
wv.Source = new Uri("https://google.com");
RadTabItem newTab = e.Item as RadTabItem;
if (newTab != null)
{
newTab.Header = "New tab";
newTab.Content = wv;
}
}
It didn’t hurt, and it actually looks pretty cool, doesn’t it? As the Telerik R2 2019 Release is already live, do not hesitate to give RadTabbedWindow a try right away and feel more than welcome to share your thoughts in the comments section below.
If by some chance this is the first time you've heard about Telerik UI for WPF, then you can explore the great variety of key features, controls and themes ready for the taking on our product page.
Viktoria is a Senior Front-end Developer with 5+ years of experience designing and building modern UI for desktop and mobile platforms on Microsoft/Telerik technology stacks. Her spare time is dedicated to friends and family and discovering new pieces of the world. Find her on Twitter and LinkedIn.