Suppose I need to set an opacity mask on a WPF control that highlights a portion of it in precise position (suppose a 50x50 square at (50;50) position). To do that I create a Dr
One workaround that may be more ideal than your current one would be to simply apply the OpacityMask
at a higher level. Using this demo code for example, you could remove the mask from the Border
and apply it to the Window
instead. With a bit of tweaking it fits properly:
You would have to write some code to move the mask when the Window
is resized, and for that reason you may be better off generating the mask dynamically in the code-behind.
My question for you is, why do you need to handle geometries that go outside the bounds of your Canvas
?