VS2010 WPF设计会自动添加的Horizo​​ntalAlignment ="拉伸"到gridsplitter [英] VS2010 WPF designer automatically adds HorizontalAlignment="Stretch" to gridsplitter

查看:176
本文介绍了VS2010 WPF设计会自动添加的Horizo​​ntalAlignment ="拉伸"到gridsplitter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个奇怪的问题,即任何时候我打开包含一个内含GridSplitter网格XAML文件,而XAML设计器运行时,它要的属性Horizo​​ntalAlignment添加到GridSplitter并设置它的值设置为拉伸。

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".

如果我设置VS2010不使用设计器,属性未添加和code保持不变。虽然我不使用设计所有的时间,很高兴在需要的时候使用。然而,去设计,它会自动每次做不必要的变化。它迫使签出源安全的文件,仅仅是一个很大的混乱。

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.

推荐答案

该GridSplitterDesignModeValueProvider类是一个不断变化的价值。 <一href="http://msdn.microsoft.com/en-us/library/microsoft.windows.design.model.designmodevalueprovider%28v=vs.90%29.aspx"相对=nofollow> DesignModeValueProvider 允许时,控制被设计的定制获取/设置逻辑被注入。这是烤到Visual Studio的设计经验。有没有简单的方法来prevent被调用此功能提供者,ATLEAST不是没有删除所有本地WPF控件的设计经验。

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.

如果你不设置的Horizo​​ntalAlignment,那么你可以将其设置为右,这是它的默认值。这应该prevent的GridSplitterDesignModeValueProvider更改它。

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.

这篇关于VS2010 WPF设计会自动添加的Horizo​​ntalAlignment =&QUOT;拉伸&QUOT;到gridsplitter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆