简体   繁体   English

如何自定义WPF TextBox控件(模板)外观?

[英]How do you customize a WPF TextBox control (template) appearance?

TextBox seems to work differently from others... Say you want a different font, rounded corners, different colors, a tiled image for the background, reduced padding above/below the text (when I change the font on an individual TextBox they get a little too tall but there's a lot of wasted space), etc. How do you do this in Blend 4? TextBox似乎与其他人的工作方式不同......假设您需要不同的字体,圆角,不同的颜色,背景的平铺图像,减少文本上方/下方的填充(当我更改单个TextBox上的字体时,他们得到了有点太高但是浪费了很多空间)等等。你怎么在Blend 4中做到这一点?

I'd like it to be in App.xaml so that it's used by default for all TextBox controls in the app. 我希望它在App.xaml中,以便它默认用于应用程序中的所有TextBox控件。

I think everything you mentioned can be done using controltemplates.What is not working ? 我认为你提到的一切都可以使用controltemplates完成。什么不起作用?

Check this link 检查此链接

http://msdn.microsoft.com/en-us/library/ms752068%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/ms752068%28v=vs.85%29.aspx

It will get you started for sure 它会让你开始肯定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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