I have successfully rendered my scene (simple geometric shapes) using a VisualCollection of DrawingVisuals, and I can successfully hit test them to see when the user clicks on one. I now need to show that element as selected.
sample code I found online changes the opacity of a drawingvisual from 1.0 to 0.4 when clicked, but this is not the effect I want to use - I would rather draw a thicker yellow outline around it, but it seems like I would have to recreate the VisualCollection from scratch (or add and remove the selected item) to change the开发者_开发知识库 border pen.
Is there a more accepted way? Adorners, maybe? Or maybe not using DrawingVisuals and using OnRender instead, and then re-rendering after an object is selected? Code example would be great.
thx.
I figured out how to do this, thanks. The key is to render the DrawingVisual in its own subroutine, and call the render proc each time an item changes state (goes from selected to unselected).
精彩评论