wpf richtextbox如何在文件中定义样式 [英] wpf richtextbox how to define style in file

查看:180
本文介绍了wpf richtextbox如何在文件中定义样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个Richtextbox,它可以显示文本,图像,控件以及可以放置在richtextbox中的任何内容.但是我想在文件中定义显示样式(也许是xml),然后richtextbox会显示其内容附加到文件中.

谁能提供一种做到这一点的方法或关于它的文章?

I am want to design a richtextbox which dispalys text, images, controls and anything which can be placed in richtextbox. but I want to define display styles in file (xml maybe), then richtextbox displays its content accroding to the file.

could anyone provide a way to do this or a article about that?
thanks in advance!

推荐答案

要加载样式:
To Load the style:
var style = System.Xaml.XamlServices.Load("style1.xaml");


保存样式:


To Save The Style:

 var styleTosave = this.FindResource("ResourceKey");
System.Xaml.XamlServices.Save("style1.xaml",styleTosave);


这篇关于wpf richtextbox如何在文件中定义样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆