wpf - Binding to DataTemplate -


i have button template:

<datatemplate x:key="templatetest">     <button margin="10" borderthickness="2" content="{binding text}" /> </datatemplate> 

i want create textbox , button content same textbox's text.

<textbox x:name="textbox" margin="10">textbox</textbox> <contentcontrol datacontext="{binding elementname=textbox}"     contenttemplate="{staticresource resourcekey=templatetest}" /> 

but don't on button in way.

@danpuzey's 1 still did not work me in vs2012. not sure why did in kaxaml

this did:

<textbox x:name="textbox"           margin="10"           text="hello world" /> <contentcontrol content="{binding elementname=textbox,                                   path=.}"                 contenttemplate="{staticresource templatetest}" /> 

and

<datatemplate x:key="templatetest">   <button height="100"           margin="10"           borderthickness="2"           content="{binding text}" /> </datatemplate> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -