【发布时间】:2012-09-13 20:27:04
【问题描述】:
我想将textbox 绑定到静态类的属性。我希望这是双向绑定。我的静态类是这样的(修剪):
public static class ocrVar
{
static ocrVar()
{
MeterNumber = new Element();
}
}
Element 类看起来像这样(修剪):
public class Element
{
public List<string> Value { get; set; }
public Element()
: this(new List<string>())
{
}
public Element(List<string> value)
{
Value = value;
}
}
如果我想获取TextBox 并将其绑定到 ocrVar.MeterNumber.Value[0],有没有办法做到这一点?
【问题讨论】:
-
请阅读Writing the perfect question,特别是示例代码和数据。最好包含代码示例,但请尽量简短。
标签: c# wpf data-binding static