Edit this page

Window Icon

RadWindow allows you to display a custom icon in its top-left corner. To specify the icon you can use either the Icon or the IconTemplate properties.

If you have a window-specific icon, use the Icon property.

As the Icon property is of type object you can set it to any control that you like. If you want to have a more complex icon content that consists of more than one control, be sure to wrap them inside a layout control and pass the layout control as content.

RadWindow is declared and opened from the code behind by default. The only way to use the RadWindow as a visual element in XAML is when it represents the entire UserControl. To learn more about that read Use RadWindow as User Control article.

RadWindow radWindow = new RadWindow();
radWindow.Icon = new Image()
{
    Source = new BitmapImage(new Uri("../../Images/WindowIcon.png", UriKind.Relative))
};
Dim radWindow As New RadWindow()
Dim image As New Image()
image.Source = New BitmapImage(New Uri("../../Images/WindowIcon.png", UriKind.Relative))
radWindow.Icon = image

This will be the final result:

Rad Window Features Window Icon 01

If you want to share a common icon layout structure for the content of multiple windows, define an appropriate DataTemplate and set it to the IconTemplate property of the RadWindow.

<UserControl.Resources>
    <DataTemplate x:Key="WindowIconTemplate">
        <Image Source="/Images/WindowIcon.png" Stretch="None" />
    </DataTemplate>
</UserControl.Resources>

RadWindow radWindow = new RadWindow();
radWindow.IconTemplate = this.Resources["WindowIconTemplate"] as DataTemplate;
Dim radWindow As New RadWindow()
radWindow.IconTemplate = TryCast(Me.Resources("WindowIconTemplate"), DataTemplate)
Was this article helpful? Yes No

Give article feedback

Tell us how we can improve this article

Dummy