Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

Using Telerik WPF RadWindow as MainWindow

Thought I would blog about how to use the Telerik abortion pill video WPF RadWindow as a MainWindow when using Visual Studio 2012 and .Net 4.5 (but I presume it will work with other versions).

So change the MainWindow.xaml from:-

<Window

to 

<telerik:RadWindow

Now this works fine but I notice that we have no taskbar icon, bit strange as this is default with the standard WPF form.  

To add this you will need a new reference:-

xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"

navigation:RadWindowInteropHelper.ShowInTaskbar="True"


Now we get the Taskbar icon back but it is the default WPF one so to add a custom one I added my own icon to a new Resource file and then referenced it:-

navigation:RadWindowInteropHelper.Icon="Resources/MyIcon.ico"


I also want how to get the pill the icon to show in the WPF window itself.  So I add the following:-

<telerik:RadWindow.Icon>

     <Image Source="Resources/MyIcon.ico" Height="18"/>

</telerik:RadWindow.Icon>


I also want to add a Telerik style to the whole form so I just add in:-

telerik:StyleManager.Theme="Windows7"

 

The complete code looks like:-

<telerik:RadWindow

    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"

    xmlns:navigation="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"

    x:Class="MyProject.MainWindow"

    telerik:StyleManager.Theme="Windows7"

    navigation:RadWindowInteropHelper.ShowInTaskbar="True"

    navigation:RadWindowInteropHelper.Icon="Resources/ReportsIcon.ico"

    Header="My Telerik Form">    

    <telerik:RadWindow.Icon>

        <Image Source="Resources/ReportsIcon.ico" Height="18"/>

    </telerik:RadWindow.Icon>

</telerik:RadWindow>

Comments are closed