I have a window with a stackpanel named stackpanel and I have added some custom controls to it in xaml which works great.
Now my program dynamically creates some user controls (with buttons) inside the stackpanel. I want to be able to click a button inside my user control and dynamically add another control to the stackpanel.
I can't seem to get this to work since it is in a different class. How can I add a control to the stackpanel from another control? I couldn't figure out how to use directcast either.