VS2010 WPF designer automatically adds HorizontalAlignment = "Stretch" to gridsplitter

I have this strange problem: when I open a XAML file containing a Grid with a GridSplitter inside it and start the XAML Designer, it wants to add the HorizontalAlignment property to the GridSplitter and set its value to "Stretch".

If I install VS2010 so as not to use the constructor, the property is not added, and the code remains the same. Although I don't use the constructor all the time, it's nice to use it when necessary. However, going to the designer, he will automatically make unwanted changes every time. This causes the file to be checked from a safe source and is just a big mess.

Has anyone ever encountered this situation? It seems very strange and specific, but I can't find anyone else on the Internet complaining about the same scenario.

+4
source share
1 answer

The GridSplitterDesignModeValueProvider class is the one that changes the value. DesignModeValueProvider allows you to enter custom input / installation logic when designing a control. This is baked into the experience of developing Visual Studio. There is no easy way to prevent this function provider from being called, at least not excluding the experience of designing all of the built-in WPF controls.

If you do not set HorizontalAlignment, you can set it to "Right", which is the default value. This should prevent the GridSplitterDesignModeValueProvider from changing.

+4
source

All Articles