Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit How to Set XAML icons as Button COntent??
4 replies. Latest Post by bradutz01 on November 16, 2009.
(0)
chiragpa
Member
11 points
37 Posts
11-06-2009 1:47 PM |
I got few XAML files as Icons. I need to set this Icons on Silverlight Button. Previously i was setting Images as Button.Content
I am not able to refer XAML icons same way. Guys, could you please help!!!!!!
Thanks in advance
MarkMonster
Contributor
5220 points
1,046 Posts
11-06-2009 3:08 PM |
You should be able to add the Xaml content (copy the content from your xaml icon file) to the Button.Content.
11-06-2009 3:28 PM |
Yes!!!!!!!
I able to do it. It works fine. Only the problem i am facing is, Image(XAML Icon) displayed in the center of the button. button still showing some area surrounded by icon. Icon is completely in center. i want to avoing button surrounded area. Just want icon. If i open XAML icon through double click it is showing perfect image. I want it should be look similar inside button without button area.
Could you please help? any button properties i need to set???
Thansk,
Chirag
11-06-2009 6:28 PM |
Thanks,
i able to do it through styles. I have copied xaml code in styles and that style referring in button style
bradutz01
66 points
49 Posts
11-16-2009 10:52 AM |
You can create a base style
<Style x:key="ButtonWithIcon" >
<ControlTemplate>
...
<Rectangle Fill={TemplateBinding Background} />
<ContentPresenter ..../>
</ControlTemplate>
</Style>
<Style x:Key="SaveStyleButton" BasedOn="{StaticResource ButtonWithIcon}">
<Setter Property="Background" Value="{StaticResoruce SaveIcon}"/>
and SaveIcon it should be a DrawingBrush.