简体   繁体   中英

TextBox with ControlTemplate - problem with property Text

I have 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM