Search code examples
wpfvb.netpopupsubclassing

subclassing a wpf popup control


I was looking for a way to drag/move a PopUp Control and I found this answer

Drag wpf popup control

unfortunately I couldn't figure out how to subclass a PopUp control, I tried creating a custom control and inheriting from PopUp but It didn't seem right to me.

any help would be appreciated!


Solution

  • You need to do exactly what you told.

    A class inheriting from the control class you want to modify, thus you will be able to make your own properties. If you want to "retemplate" that control you'll need a place to store the styles, templates, and so on.

    Take a look at this answer below to see further, its about changing a MenuItem control but you are going to use the same tricks.

    How to convert a manually created WPF Menuitem into a Template / Style Resource / Control Template