mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-20 00:06:45 +08:00
暂时实现了简陋的脚本AST分析解释,后面再绑定到控件上
This commit is contained in:
28
Workbench/Themes/BindableRichTextBox.cs
Normal file
28
Workbench/Themes/BindableRichTextBox.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows;
|
||||
|
||||
namespace Serein.Workbench.Themes
|
||||
{
|
||||
public partial class BindableRichTextBox : RichTextBox
|
||||
{
|
||||
public new FlowDocument Document
|
||||
{
|
||||
get { return (FlowDocument)GetValue(DocumentProperty); }
|
||||
set { SetValue(DocumentProperty, value); }
|
||||
}
|
||||
// Using a DependencyProperty as the backing store for Document. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty DocumentProperty =
|
||||
DependencyProperty.Register("Document", typeof(FlowDocument), typeof(BindableRichTextBox), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnDucumentChanged)));
|
||||
private static void OnDucumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
RichTextBox rtb = (RichTextBox)d;
|
||||
rtb.Document = (FlowDocument)e.NewValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user