开发者

Programmatically setting a templated Button's VisualStates

In my WP7 application, I have a ListBox populated with buttons. I have a 'Pressed' visual state configured, and it works great. However, 开发者_JS百科I would like to disable that 'Pressed' visual state (temporarily set it to do nothing) while the ListBox is scrolling.

I've created an event handler for detecting when the ListBox is scrolling (using Peter Torr's blog entry here. Using that event handler, how can I alter/disable that 'Pressed' visual state, and also return it to its originally (through XAML) defined state? The ListBox 'Generated Items' template is the button control, which itself is templated to use my custom 'Pressed' state animation.

Thanks!


This is not execly what are you looking for, but you can try setting

myButton.IsEnabled = false;

I assume your goal is to prevent user from clicking a button while scrolling.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜