Styling an adorner
Hey, I have a bunch of开发者_StackOverflow中文版 ContentControls on a Canvas, the ContentControls each have an adorner on top of them to increase the selection area (some ContentControls may be rendered as 1-pixel lines, and so are hard to click on).
I'd like to allow the adorners to be styled by anyone from XAML, so for example when the mouse is over the adorner, it will show a blue outline.
How can I allow the adorner to pick up a ControlTemplate from my resource dictionaries?
Thanks.
An Adorner
can have any number System.Windows.Media.Visual
-derived element as its children. So you could create a UserControl
or Custom Control and host it within the Adorner
. That way styling/templating it should be the same as it is when using those controls elsewhere.
精彩评论