This is a migrated thread and some comments may be shown as answers.

Set an Icon in a Theme to apply to all RadWindows

1 Answer 274 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pedro
Top achievements
Rank 1
Pedro asked on 27 Nov 2016, 07:09 PM

Hi Telerik team,

What i'm trying to achieve is very simple, I just want to set an Icon image to RadWindow Template so it will be reflected in every RadWindow instances I create later:

 - I'm using Windows 8 theme and I have copied the needed XAML files.
 - The image is a .ico file from the folder "Resources\MyImage.ico"

Although I have search in the documentation and in the forums I couldn't find a solution that find my needs, I do not want to use code behind to set the icon in every window.

I'm looking forward your response.

Best regards,
Pedro Galusso

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 28 Nov 2016, 12:37 PM
Hello Pedro,

You could create a global style for the RadWindow and define your image in its Icon setter. If you put/merge the style in your App.xaml and make it implicit (without a key), it will be applied to all the instances of the control:
<Style BasedOn="{StaticResource RadWindowStyle}" TargetType="telerik:RadWindow">
  <Setter Property="Icon">
    <Setter.Value>
      <Image Source="<local path to your logo>" />
    </Setter.Value>
  </Setter>
</Style>

Note several things:

To receive all the styling that we ship for the theme chosen, the style needs to be BasedOn on the default one (which needs to be merged in your application beforehand - in other words you need to define your style after the merged dictionaries for the theme).

The Icon property provides value for a ContentPresenter, so you might need to define the image's Width and Height explicitly, and also - any limitations about images present in the WPF framework apply - e.g. the need for 96dpi for best rendering etc.

Regards,
Martin
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
General Discussions
Asked by
Pedro
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or