wpf - Why is this Binding not working in XAML? -
i'm using xaml simulate watermark text on textbox, binding text property not working:
<textbox x:name="txtsearch" borderthickness="0"> <ap:cuebannerservice.cuebanner> <textblock foreground="black" opacity=".7" text="{binding path=watermarktext}"/> </ap:cuebannerservice.cuebanner> </textbox>
on other hand, of follow code works:
<textblock foreground="black" opacity=".7" text="watermark test"/> <textbox opacity=".7" text="{binding path=watermarktext}"/>
why not working? thank you!
update
this works fine (without textblock):
<textbox x:name="txtsearch" borderthickness="0" ap:cuebannerservice.cuebanner="{binding path=watermarktext}">
update 2
this works!:
<textbox x:name="txtsearch" borderthickness="0"> <ap:cuebannerservice.cuebanner> <textblock foreground="black" opacity=".7" text="watermark text"/> </ap:cuebannerservice.cuebanner> </textbox>
replace binding textblock following:
{binding datacontext.watermarktext, relativesource={relativesource ancestortype={x:type textbox}}}
will check why did not work.
this should work! ensuring datacontext assosciated textbox being used textblock:
{binding datacontext.watermarktext, elementname=txtsearch}
Comments
Post a Comment