如何在linq类中获得多重绑定的价值 [英] How get value a multibinding in a linq class

查看:76
本文介绍了如何在linq类中获得多重绑定的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我将LinqClass绑定到我的Listbox.ItemsSource

然后在Textblock中创建一个多重绑定到我的listboxitem样式中,如下所示:

hi everyone

i bind a LinqClass to my Listbox.ItemsSource

then i create a multibinding in a Textblock into my listboxitem style like this :

<TextBlock>
										<TextBlock.Text>

<MultiBinding>
												<MultiBinding.Converter>
													<local:Class_ConvertPumpsName/>
												</MultiBinding.Converter>
												<Binding Path="Target1"/>
												<Binding Path="Target2"/>                   		
											</MultiBinding>

</TextBlock.Text>

</TextBlock>



现在我该如何获取我的样式的这种多重绑定(我的样式绑定到linqclass)
谢谢

[从解决方案中移出]
更多说明:
我想在文本属性textblock中获取当前值
我的文本块是listboxitem样式,它绑定到multibinding
谢谢



Now how can i getback vlaue of this multibinding of my style(My Style bind to linqclass )
thank you

[Moved from solution]
more description :
i want get current value in text property textblock
my textblock is a listboxitem style and it''s binding to a multibinding
thank you

推荐答案

问题出在RelativeSource上.它应该是这样的:

The problem was with the RelativeSource. This is how it should look like:

<textblock>
   <textblock.text>
	<multibinding>
		<multibinding.converter>
			<local:class_convertpumpsname xmlns:local="#unknown" />
		</multibinding.converter>
		<binding relativesource="{RelativeSource TemplatedParent}" path="Target1" />
		<binding relativesource="{RelativeSource TemplatedParent}" path="Target2" />                   		
	</multibinding>
   </textblock.text>
</textblock>


这篇关于如何在linq类中获得多重绑定的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆