【问题标题】:Silverlight Control property as a data binding Source and View-Model property as targetSilverlight 控件属性作为数据绑定源和视图模型属性作为目标
【发布时间】:2011-04-22 19:45:06
【问题描述】:

我在 Silverlight 控件上有一个 ViewModel 想要绑定到的属性。 ViewModel 需要告知属性的更改,而不是相反

语法类似

<MyControl ViewPort="{Binding VMProperty}"/>

将 ViewPort 声明为 Target,在此实例中 ViewPort 是数据的源。我知道我可以让它成为双向绑定,但是当我只想要一种方式但在另一个方向时,这似乎是错误的。

此外,我不想让控件上的属性成为 DependencyProperty,因为我不希望该属性可设置,而且我不相信 Silverlight 支持只读依赖属性。

是否有其他设置绑定的方法?

TIA

帕特龙

【问题讨论】:

    标签: silverlight data-binding mvvm dependency-properties


    【解决方案1】:

    也许这行得通? http://forums.silverlight.net/forums/p/141042/315359.aspx#315359

    {Binding ElementName=TextBox1, Path=Text, Mode=TwoWay ,UpdateSourceTrigger=Explicit}

    【讨论】:

      猜你喜欢
      • 2010-09-27
      • 1970-01-01
      • 2010-12-21
      • 2021-12-01
      • 1970-01-01
      • 2014-12-30
      • 2010-12-16
      • 2011-05-08
      • 1970-01-01
      相关资源
      最近更新 更多