Hello all,
I am trying to convert my WPF application into a WPF UserControl. In the original application, I had intentionally modified the margins of certain elements so that their edges were not within the bounds of the window. I did this in order to hide undesirable borders that I could not get rid of without having to write my own control template. It was a simple fix, but unfortunately this technique is not working when my application is made into a UserControl. If I set the width of my UserControl to the same width as the window in my original application, when I view this UserControl within a test application, the elements whose borders I wanted to hide are now fully visible.
It doesn't make sense to me why this would happen. If I set the width of the UserControl to a certain WIDTH, then the width of the UserControl should be equal to WIDTH, right? Well, as you can see below in Image 1, all the elements of the UserControl are fully visible, no matter what I set WIDTH to be. The desired visual (the one I used to get in the original application) is shown in Image 2, where the elements are properly cut off by the boundaries of the window.
How can I ensure that elements with negative margins will display the way I want them to in a UserControl? Any help on accomplishing this would be greatly appreciated.
Thank you so much,
Dalal