开发者

Defining Textbox-behaviour in XAML without Codebehind

what I want to achieve is a pretty common thing, but I want to use the Silverlight advantage to keep the UI-Behaviour in XAML.

I want a Textbox which has an 'empty' state like this:

[ Name ]

(Name in gray font), and when the Textbox receives Focus, the Fontcolor 开发者_StackOverflow中文版is supposed to change to black and the Textbox is supposed to be really empty.

When Unfocused and still empty it's supposed to say "Name" in gray font again.

Now I fail to find information on how to achieve this extended behaviour without using Codebehind... and gratefully appreciate any hints ;-)


You may try to use control templates to create textbox acting your way. Check this blog entry

for an example (it's done there with checkbox). Also a good tool for creating templates is Microsoft Blend

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜