Whitelist Child Controls of Canvas Subclass at Design time

46 views Asked by At

I'm trying to find a way to prevent certain controls from being added to a canvas in my project at design time.

I've created a subclass of Canvas, and so far have tried:

  1. Overriding OnVisualChildrenChanged and performing a check for the correct classes.

    • I then tried removing the visualAdded as both a visual and logical child, but no dice.
    • I also tried just doing nothing if the object being added wasn't of a desired type, but the object would still be added to the canvas.
  2. Creating new methods for AddVisualChild and AddLogicalChild to control the behavior.

    • Doesn't work at all.

I'm wondering if there are any other overrides or methods I could override with 'new' that could give me the control I want, or if there is anything I could leverage to control what is added.

0

There are 0 answers