4
votes

I have this strange issue where anytime I open a XAML file that contains a Grid with a GridSplitter inside it, and the XAML Designer runs, it wants to add the property HorizontalAlignment to the GridSplitter and set it's value to "Stretch".

If I set VS2010 to not use the designer, the property is not added and the code remains the same. While I don't use the designer all the time, it's nice to use when needed. However, by going to the designer, it will automatically make the unwanted change every time. It forces the file to be checked out of source safe and is just a big mess.

Has anyone ever run into this situation? Seems very strange and specific, yet I can't find anyone else online complaining about the same scenario.

1
I'm really confused as to what is causing this as I thought for sure at least one person here would have run into the same issue. But nothing.Ristogod

1 Answers

4
votes

The GridSplitterDesignModeValueProvider class is the one changing the value. DesignModeValueProvider allow custom getting/setting logic to be injected when a control is being designed. This is baked into the Visual Studio design experience. There's no easy way to prevent this feature provider from being called, atleast not without removing the design experience of all the native WPF controls.

If you are not setting HorizontalAlignment, then you could set it to "Right" which is it's default value. That should prevent the GridSplitterDesignModeValueProvider from changing it.