开发者

WPF - Generate BitmapSource from Over state of a button

I can generate a BitmapSource from a button fine, however it always is just the image of the normal state of the button.

I want to be able to generate a BitmapSource of the over state of a button.

I tried calling VisualStateManager.GoToState((FrameworkElement)target, "MouseOver", true); before calling my code to generate the BitmapSource. It correctly changes the button 开发者_开发百科to the overstate on the GUI, but the BitmapSource is still that of the button in the normal state.


I figured out the problem. VisualStateManager.GoToState((FrameworkElement)target, "MouseOver", true); just begins the transition to the specified state. I needed to give control back to the UI thread and wait for the state to actually change before trying to save the bitmap.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜