从代码隐藏发送多个值到数据网格字段转换器
我正在运行时创建 infragistics wpf 网格。
在 FieldLayoutInitialized 中,我正在创建未绑定的字段。
一个示例未绑定字段是
UnboundField field = new UnboundField();
field.Name= "Testfield";
field.BindingPath = "Binding path";
FieldLayout fieldLayout;
fieldLayout.Fields.Add(field)
但我的要求是我有一个计算字段,因此我创建了转换器。转换器将返回两个值的总和。
A3=A1+A2;
如果它来自 XAML 文件,我们可以这样写
<Textbox.Value>
<MultiBinding Converter="{StaticResource ConvertnameClass}" Mode="OneWay">
<Binding Path="A1"/>
<Binding Path="A2"/>
</MultiBinding>
</Textbox.Value>.
field.Converter = coverter class object; 字段.ConverterParameter = ???;
如果是单一绑定,我们可以发送 field.BindingPath = "类属性值";
当创建运行时时,如何从代码后面向转换器发送多个绑定值。
请帮助我。
I am creating infragistics wpf grid at runtime.
in FieldLayoutInitialized i am creating unbound fields.
one sample unbound field is
UnboundField field = new UnboundField();
field.Name= "Testfield";
field.BindingPath = "Binding path";
FieldLayout fieldLayout;
fieldLayout.Fields.Add(field)
But my requirement is i have a field which is calculated one so for that i created converter. converter will return sum of two values.
A3 = A1+A2;
If it is from XAML file we can write like
<Textbox.Value>
<MultiBinding Converter="{StaticResource ConvertnameClass}" Mode="OneWay">
<Binding Path="A1"/>
<Binding Path="A2"/>
</MultiBinding>
</Textbox.Value>.
field.Converter = coverter class object;
field.ConverterParameter = ???;
if it is single binding we can send the
field.BindingPath = "class prop value";
how can i send multiple binding values to converter from code behind when it is creating run time.
please help me out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个在代码后面创建多重绑定的示例,
将其放在您的 FieldLayoutInitialized 事件中,
您可能必须为两个绑定指定 Source 或relativeSource
希望这会有所帮助(我使用了 11.1 库)
here is a sample that creates a multibinding in code behind
put this at your FieldLayoutInitialized event
probably you must specify Source or RelativeSource for the two bindings
hope this helps (i used the 11.1 libs)