TextBox with ControlTemplate - problem with property Text
I ha开发者_如何学JAVAve one big problem with passing value from a ControlTemplate
to the control. TextBox
has a ControlTemplate
, how can I pass value from this template to the TextBox
text?
All you need is a container with the name PART_ContentHost
.
Here's the complete example on how to create a control template for a textbox: TextBox Styles and Templates. In this case the textbox is presented inside a ScrollViewer
.
Hope it helps!
If I truly understand your problem, you want to Show Text Value of Textbox in custom Textbox Control.
So for doing this, you must use Template-Binding
in template Like :
<CustomControl Text="{TemplateBinding Text}">
CustomControl refer to any control you use in Template.
精彩评论