Based on WPF & Prism & AvalonEdit of lightweight XAML editor

1. EDITORIAL

        WPF has been engaged in development-related work, sometimes in order to try to demonstrate some time or based solely on the effect of XAML, but do not want to go to war to create VS project open, so a simple light, editing and preview in one set of XAML editor is particularly important.

  • Kaxaml, set editing and preview the past has been in use, but could not know what the reason, the recent frequent crashes, although there are open source codes to follow, but also lazy to download debugging;
  • XAML Studio, can only be used on Win10, and only for UWP, was forced to give up.

Well, simply their own hands and clothing! In this way, XAML Viewer born, and completely open source!

2. Interface Preview

        Non-professional graphic design, coupled with the structure of the document editing Zhenggewoyi VS, and personal favorite is relatively VS design style, so do not torture yourself.

3. The project constitutes

        Software is mainly based on WPF, Prism , AvalonEdit , only core code is as follows (the others are icing on the cake):

  Element = XamlReader.Parse(content) as FrameworkElement;
  • XamlDesigner: Prism module, provides a preview function XAML;
  • XamlEditor: Prism module, provides XAML editing features, provides smart tips Oh, although not as powerful VS comprehensive, but general enough to use;
  • XamlService: Event and is mainly used for the definition of Prism Command;
  • XamlTheme: providing style related controls or auxiliary class;
  • XamlUtil: providing universal algorithm and the like;
  • XamlViewer: main program, other than the above synthesizer.

4. Document Management

  • Support new, open, save, close, drag and other operations;
  • Support preview and editing position swapping operation panel;
  • Supports quick selection for open files in Active Files drop-down list.

注意:在关闭软件时,只会自动保存已经存储在本地的文档,请务必在此之前,将需要保留的临时文档保存到本地。

5. 自动编译

  • Auto-Compile 勾选框,开启或关闭自动编译功能,但手动编译[F5],一直生效;
  • Auto-Compile Delay 滑块,在无任何输入的指定时间后自动执行编译。

6. 第三方控件库的引用

    [Setting] >> [Reference] >> [Add]: 添加自定义控件库,可以在XAML中直接引用其中控件。

  • 1. 当前软件基于.Net Framework 4.5,只要系统中包含.Net Framework 4.X(X >= 5),即可引用基于4.0--4.X任意版本的控件库;
  • 2. 引用自定义控件库时,请按照以下形式声明命名空间:
 xmlns:controls="clr-namespace:MyControl.Controls;assembly=MyControl"

7.  写在最后

       由于只是个人利用闲暇时间编写,精力有限,有些地方未必测试到位,代码也稍显简陋,注释欠缺,所以,在使用的过程中,若遇到各种各样的问题,对哪块代码理解不清的,或有更好的建议的,都可以在Github上进行反馈,我看到后会尽量回应,请大家多多支持。

       代码可以使用VS2012及以上版本进行编译,目前基于.Net Framework 4.5,后续有时间的话,我会调整为多目标编译,增加.Net Core 3.0。

 Github地址如下:https://github.com/huangjia2107/XamlViewer

 

Guess you like

Origin www.cnblogs.com/smlusm/p/12150358.html