There's a text box and some view model with detail
public class Detail { public string Value {get;set;}}
public class SomeVM
{
public Detail {get;set;}
}
Trying to bind to textbox with this code:
textBox.DataBindings.Add开发者_StackOverflow社区("Text", new SomeVm (), "Detail.Value");
But it says "there's no property to bind". Is there a solution for this problem?
Have you tried:
public string Value
{
get
{
return _someVm.Value;
}
set
{
_someVm.Value=value;
}
}
private readonly SomeVM _someVM=new SomeVM();
...
textBox.DataBindings.Add("Text", _someVm, "Value");
精彩评论