Skip to main content

Microsoft Silverlight

Answered Question How to Set XAML icons as Button COntent??RSS Feed

(0)

chiragpa
chiragpa

Member

Member

11 points

37 Posts

How to Set XAML icons as Button COntent??

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
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Answered Question

Re: How to Set XAML icons as Button COntent??

You should be able to add the Xaml content (copy the content from your xaml icon file) to the Button.Content.

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

chiragpa
chiragpa

Member

Member

11 points

37 Posts

Answered Question

Re: How to Set XAML icons as Button COntent??

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

chiragpa
chiragpa

Member

Member

11 points

37 Posts

Re: How to Set XAML icons as Button COntent??

Thanks,

i able to do it through styles. I have copied xaml code in styles and that style referring in button style

bradutz01
bradutz01

Member

Member

66 points

49 Posts

Re: How to Set XAML icons as Button COntent??

 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}"/>

</Style>

 

and SaveIcon it should be a DrawingBrush.

Making things easier for developers.
-----------------------------------
www.xamltemplates.net
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities