【问题标题】:String binding error字符串绑定错误
【发布时间】:2012-11-10 01:25:14
【问题描述】:

为什么我不能在我的类中创建一个简单的 WPF 字符串数据绑定?

错误:重载解析失败,因为没有可访问的“新”接受此数量的参数。

我关注了this example in MSDN

Dim s As String = "Test string"
Dim b As New Binding("Description of bind")
b.Mode = BindingMode.OneTime
b.Source = s

【问题讨论】:

  • 您知道应该将绑定Path 传递给构造函数,而不是绑定的任何文本描述吗?
  • 感谢您的评论,但您的意思是什么?可以举个例子吗?
  • 我向您指出,"Description of bind" 很可能不是您调用的Binding constructor 的有效参数。构造函数不接受对绑定性质的任何文本(人类语言)描述;它需要一个绑定Path,它具有您必须遵守的特定语法;例如"/Offices/ManagerName""ShoppingCart.Order"See the documentation of Binding.Path for details.

标签: wpf vb.net data-binding binding


【解决方案1】:

我不熟悉 VB,但似乎该行应该是:

Dim b As New Binding()
b.Path = New PropertyPath("Description of bind")

我提到了这个link

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-09-13
    • 1970-01-01
    • 2012-04-29
    • 2011-10-20
    • 1970-01-01
    • 1970-01-01
    • 2014-10-07
    相关资源
    最近更新 更多