WPF模板绑定 [英] WPF TemplateBinding
本文介绍了WPF模板绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨.
一般问题.我有一个ControlTemplate
,相当复杂,有几个TextBox
等,
我不能使用TemplateBinding
将所有属性带到曲面上,以便可以设置所有样式.
样式是否可以潜入"控件中的控件以设置值?
希望我的问题清楚,没有例子.
谢谢
Hi.
General question. I have a ControlTemplate
that is reasonably complex, several TextBox
es, etc.
I can''t use TemplateBinding
to bring all the properties to the surface so that I can set all the styles.
Is there a way for a Style to ''delve'' into the controls within a control to set values?
Hope my question is clear without an example.
Thanks
推荐答案
否,
问题尚不清楚:-D
您可以从样式内设置控件的属性.例如,对于textbox
:
No,
The question isn''t clear :-D
You can set properties of controls from within the style. For example, for atextbox
:
<Setter Property="Textbox.Text" Value="Tra la la"/>
需要将datacontext
向下传送到样式中的textbox
es等.希望有帮助.
Thedatacontext
needs to be carried down to thetextbox
es, etc. that are within the style. Hope that helps.
这篇关于WPF模板绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文