I created a custom MediaElement, very simple, just to add another property to it, which influences the layout of the MediaElement. The property is AspectRatio, which is the aspect ratio that the MediaElement has to obey. We work with 4:3 and 16:9.
The documentation (InvalidateMeasure) states: "One such advanced scenario is if you are creating aPropertyChangedCallback for a dependency property that is not on a Freezable or FrameworkElement derived class that still influences the measure pass of layout when it changes."
Which is exactly my scenario. So, when the user selects 4:3, I call InvalidateMeasure which will calculate the desired size accordingly. The problem is that the MediaElement does not respect the desired size at all. I've even tried to change the Stretch property, but none of them work either.
I uploaded a sample: http://sdrv.ms/1bInNwo
How can I make this work? How can I assure that the desired size is indeed applied?
Take a look at WPF FlashMessage
About.me