Silverlight中没有Label控件吗?

前端之家收集整理的这篇文章主要介绍了Silverlight中没有Label控件吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我似乎无法在Silverlight中找到Label控件.如果我把XAML放在任何地方,我会收到编译错误.

解决方法

TextBlock与WinForms中的Label大致相同.

按照MSDN

The TextBlock control is the primary
element for displaying text in
Silverlight based applications.

Provides a lightweight control for
displaying small amounts of text…

编辑:我刚刚注意到Silverlight 3的标签.标签应该内置在Silverlight 3中,所以你确定你不使用2吗?

您可能需要考虑TextBlock,具体取决于您使用它的方式.再次按照MSDN

A Label control displays a caption,required field indicator,and validation error indicator to the user. It is typically used together with an input control,such as a TextBox. If you do not need to display required field or validation indicators,you can use the TextBlock control instead.

猜你在找的Silverlight相关文章