Skip to main content

Microsoft Silverlight

Answered Question How can i implement the Button "down" style always?RSS Feed

(0)

spiderman110
spiderma...

Member

Member

220 points

276 Posts

How can i implement the Button "down" style always?

 Hi, all

like the winform's button FlatStyle property.

I want to set the button always down, like 

Button.FlatStyle = FlatStyle.Flat;

How can i implement it?

murtaza.dharwala
murtaza....

Participant

Participant

1659 points

378 Posts

Re: How can i implement the Button "down" style always?

 YOu can modify the buttons Content Template to a style which gives some thing to windows Flat style Button.

Murtaza Dharwala
Diaspark Inc.
www.diaspark.com
email:murtaza.dharwala@diaspark.com


Please remember to click “Mark as Answer” on the post that helps you

Amanda Wang - MSFT
Amanda W...

All-Star

All-Star

17234 points

1,466 Posts

Re: How can i implement the Button "down" style always?

Hi,

Try to refer the below code:

<Button x:Name="btn"  Content="button"  >
            <Button.Template>
                <ControlTemplate>
                    <Grid x:Name="RootElement">
                        <Rectangle x:Name="BodyElement" Width="200" Height="100" Fill="Lavender" Stroke="Purple"  />
                        <TextBlock Text="Click Me" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Button.Template>
        </Button>

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

surbhiydv
surbhiydv

Participant

Participant

1134 points

218 Posts

Re: How can i implement the Button "down" style always?

Hi

To set the button style in pressed state always, just copy the vsm style storyboard for pressed visual state and paste it as it is in vsm style storyboard for normal visual state

hope this will help you

(Please 'Mark as Answer'..........if it helps you)

sladapter
sladapter

All-Star

All-Star

17181 points

3,133 Posts

Answered Question

Re: How can i implement the Button "down" style always?

You can use ToggleButton and define your own Checked state in the Template(if you do not want use the default template). With ToggleButton, one click should change it to checked state, 2nd click should made it back to normal. If you want it to stay at checked state, just set Checked=true.

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities