Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top