8,734
社区成员
发帖
与我相关
我的任务
分享
private void BindResult(string methodName, ref TextBox txtResult)
{
ObjectDataProvider odp = new ObjectDataProvider();
odp.ObjectInstance = new ProjectData();
odp.MethodName = methodName;
odp.MethodParameters.Add("0");
odp.MethodParameters.Add("0"); Binding bindToArg1 = new Binding("MethodParameters[0]")
{
Source = odp,
BindsDirectlyToSource = true,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
};
Binding bindToArg2 = new Binding("MethodParameters[1]")
{
Source = odp,
BindsDirectlyToSource = true,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
};
Binding bindResult = new Binding(".") { Source = odp };
this.slider1.SetBinding(Slider.ValueProperty, bindToArg1);
this.slider2.SetBinding(Slider.ValueProperty, bindToArg2); txtResult.SetBinding(TextBox.TextProperty, bindResult);
}