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

How to set the window icon programmatically?

3 Answers 85 Views
Window
This is a migrated thread and some comments may be shown as answers.
Nestor Soriano Vilchez
Top achievements
Rank 1
Nestor Soriano Vilchez asked on 08 Jun 2010, 05:28 PM
Is there any way to programmatically set the icon of a Window control? I am trying to set the Icon property of the window to an instance of BitmapImage that I have previously set up from a resource, but it does not work (no icon is shown whatsoever).

3 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 09 Jun 2010, 12:52 PM
Hi Nestor,

 You could refer to the following example: http://demos.telerik.com/silverlight/#Window/WindowIcon. You could use the same approach to set it in your code.

Greetings,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nestor Soriano Vilchez
Top achievements
Rank 1
answered on 09 Jun 2010, 04:04 PM
Thank you for your reply. I had looked at these examples already, and I understand how to set the window icon from a resource at design time. But what I want is to set the window icon after the window pbject has been instantiated (overwriting any other possible icon already in place). Something like this:

var window = new RadWindow();
//Set the window icon 
window.Icon = ??? 
//...now set another different icon 
window.Icon = ??? 

0
Miroslav Nedyalkov
Telerik team
answered on 10 Jun 2010, 02:22 PM
Hi Nestor,

 What you need to do is to create a new Image object, set its Width and Height and its Source and set the Icon property of the Window to be this Image. For more information about how to create and initialize Image in code-behind you could refer to the following forum thread: http://forums.silverlight.net/forums/p/11780/37722.aspx.

Greetings,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Window
Asked by
Nestor Soriano Vilchez
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Nestor Soriano Vilchez
Top achievements
Rank 1
Share this question
or