onmyway133
onmyway133

Reputation: 48185

WP7 how to create a button that change background image when pressed

I see [some questions about how to change button background using Visual State Manager][1]. But what I want is a button that can be used in XAML like this

<Button NormalImage="/image/normal.png" PressedImage="image/pressed.png />

There user can specify 2 images for 2 button states (Normal and Pressed), and when the button is pressed, it uses the PressedImage.

How to do that ?

Upvotes: 0

Views: 329

Answers (1)

Berni
Berni

Reputation: 510

You would have to make your own user control and have those properties exposed as dependency properties so you are able to bind them.

In you user control, you can use the visual state manager to change the background when click/tap event is received

Upvotes: 1

Related Questions