如何在Silverlight中使用RichTextBlock控件? [英] How to use RichTextBlock control in Silverlight?
问题描述
大家好,
我想在我的Silverlight应用程序中使用RichTextBlock控件.我已经在项目中添加了对"System.Windows" dll的引用,并在了Silverlight页面中添加了"System.Windows.Controls"命名空间.但是我仍然无法使用此控件.我应该安装任何最新版本的Silverlight Toolkit.请帮我. . .
在此先感谢
Hi everyone,
I want to use RichTextBlock control in my silverlight application. I have added the reference of "System.Windows" dll to my project and "System.Windows.Controls" namespace to my silverlight page. But i am still not able to use this control. Should i install any latest version of Silverlight Toolkit. Please help me. . .
Thanks in advance
推荐答案
这是标准的Silverlight还是Windows Phone 7?哪个版本?
您应该能够直接使用RichTextBlock
而不添加任何新的名称空间/using语句.我已经测试了Silverlight 3、4和5(使用VS2010),默认情况下,所有这些功能均可用.万一您误删除了某些内容,在空白项目中我引用的DLL是:
- mscorlib
- 系统
- System.Core
- System.Net
- System.Windows
- System.Windows.Browser
- System.Xml
Is this standard Silverlight or Windows Phone 7? Which version?
You should be able to use aRichTextBlock
straight out of the box without adding any new namespaces / using statements. I''ve tested Silverlight 3, 4 & 5 (using VS2010) and it''s available by default for all of them. Just in case you''ve deleted something by mistake, my referenced DLLs in a blank project are:
- mscorlib
- system
- System.Core
- System.Net
- System.Windows
- System.Windows.Browser
- System.Xml
using System.Windows.Controls;
这是默认的XAML:
And here''s the default XAML:
<usercontrol x:class="RichTextBox3.MainPage" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<grid x:name="LayoutRoot" removed="White">
<richtextblock />
</grid>
</usercontrol>
如果您是为Windows Phone编写的,则它又称为RichTextBox
,在System.Windows.Controls
下也是如此.我认为它可能仅从7.1版开始可用.
希望能有所帮助.如果有的话,请标记为答案.
If you''re writing for Windows Phone then it''s called a RichTextBox
, again under System.Windows.Controls
. I think it might only be available from version 7.1.
Hope that helps. Please mark as the answer if it does.
这篇关于如何在Silverlight中使用RichTextBlock控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!