【发布时间】:2011-01-21 14:07:15
【问题描述】:
在我的一个应用程序中,我有这样的代码:
<ProgressBar Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" Height="27" Margin="5,0,5,0" Maximum="{Binding TabuProgressEnd}" Value="{Binding TabuProgress}" />
虽然我在测试这一切都很好,但是当我的客户在 VS 下打开它并运行此代码时引发了异常:
An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll
Additional information: A TwoWay or OneWayToSource binding cannot work on the read-only property 'TabuProgress' of type 'TSPLib.TabuEngine'.
通常我会认为这是某种骗局,但我知道这家伙不知道编码和明确“Mode=OneWay”的帮助。不同机器上的默认绑定模式怎么可能不同?
【问题讨论】:
-
这听起来像是框架的版本问题。我不确定默认绑定模式何时更改,但它可能位于其中一个服务包(或修补程序)中。这些年来似乎发生了一些奇怪的变化,而且很难跟踪。你的目标是什么版本?
-
Net Framework 4.0,与 Visual Studio 2010 一起安装。我不能确定,但这可能是新的东西,因为我的客户两天前安装了 VS Pro 试用版。也许是 Sp1..