Adorner not showing up

2.4k Views Asked by At

I am using an UserControl that contains the Canvas. As child of the canvas there is content control with adorner. Why the adorner is not visible perhaps the adorner layer is ceated. Everything is created and attached. The adorner layer is very high in a visual tree. The adorner layer is placed outside the UserControl.

I know that is created because I implemented basic movement mechanism that works but the decorator never shows up.

What has to be done to show the decorator?

1

There are 1 best solutions below

0
On

A WPF window by default has an AdornerDecorator but a usercontrol does not. So you just have to wrap your Canvas with an Adorner decorator in your usercontrol.xaml:

<AdornerDecorator ClipToBounds="True">
            <Canvas x:Name="DesignerCanvas"
            ClipToBounds="True"
            SnapsToDevicePixels="True"/>
</AdornerDecorator>

More info: https://social.msdn.microsoft.com/Forums/vstudio/en-US/43a2565d-df21-4cf3-aa2a-240d67662945/please-help-me-resolve-a-mistery-with-resource-adorner-and-usercontrol-a-bug?forum=wpf