RichEditBox控件装载并显示RTF文件内容
2014-03-19 21:30
465 查看
环境
[1]Visual Studio 2013
[2]Win Store App 8.1
正文
XAML部分内容
C#部分内容
public async Task Model2View()
{
Uri dataUri = new Uri("ms-appx:///Assets/rtf/preface.rtf");//Build Action为Content
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);
if (file != null)
{
Windows.Storage.Streams.IRandomAccessStream randAccStream =
await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
// Load the file into the Document property of the RichEditBox.
reb.Document.LoadFromStream(Windows.UI.Text.TextSetOptions.FormatRtf, randAccStream);
reb.IsReadOnly = true;
}
}
[1]Visual Studio 2013
[2]Win Store App 8.1
正文
XAML部分内容
<RichEditBox x:Name="reb" Background="#FF0F243E" BorderThickness="0" Margin="4"/>
C#部分内容
public async Task Model2View()
{
Uri dataUri = new Uri("ms-appx:///Assets/rtf/preface.rtf");//Build Action为Content
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);
if (file != null)
{
Windows.Storage.Streams.IRandomAccessStream randAccStream =
await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
// Load the file into the Document property of the RichEditBox.
reb.Document.LoadFromStream(Windows.UI.Text.TextSetOptions.FormatRtf, randAccStream);
reb.IsReadOnly = true;
}
}
相关文章推荐
- 李振杰:中科红旗的生与死
- 手机安全测试 学习笔记 V0.1
- [转]非常不错的Silverlight资源汇总
- 《Lucene in Action 第二版》第三章节的学习总结----IndexSearcher以及Term和QueryParser
- DOM插入元素-----插入到元素前面
- DOM替换节点
- hdu2594 Simpsons’ Hidden Talents(KMP,前后缀)
- throws和try/catch的区别与联系
- hdu1686 Oulipo(KMP)
- hdu2087 剪花布条(KMP)
- applicationContext.xml
- 安装PLSQL
- java socket编程
- applicationContext.xml
- 二进制数,错位相乘
- debug(fmt,args...)调试
- PyQt4之对话框示例
- 深入理解Java Class文件格式(二)
- hdu1711 Number Sequence(KMP)
- 集合上的动态规划—最优配对问题