12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using InABox.Core;
- using System.Windows;
- using System.Windows.Media;
- namespace InABox.DynamicGrid
- {
- public class RichTextEditorControl : DynamicEditorControl<string, InABox.Core.RichTextEditor>
- {
-
- static RichTextEditorControl()
- {
- //DynamicEditorControlFactory.Register<RichTextEditorControl, InABox.Core.RichTextEditor>();
- }
-
- private RichTextEditor Editor;
- public override int DesiredHeight()
- {
- return int.MaxValue;
- }
- public override int DesiredWidth()
- {
- return int.MaxValue;
- }
- public override void SetColor(Color color)
- {
- Editor.SetColor(IsEnabled ? color : Colors.WhiteSmoke);
- }
- public override void SetEnabled(bool enabled)
- {
- Editor.Editor.IsReadOnly = !enabled;
- Editor.ZoomFactor = 100;
- SetColor(enabled ? Color : Colors.WhiteSmoke);
- }
- public override void SetFocus()
- {
- Editor.Focus();
- }
- public override void Configure()
- {
- }
- protected override FrameworkElement CreateEditor()
- {
- using var profiler = new Profiler(true);
- MinHeight = 250;
-
- Editor = new RichTextEditor
- {
- VerticalAlignment = VerticalAlignment.Stretch,
- //VerticalContentAlignment = VerticalAlignment.Top,
- HorizontalAlignment = HorizontalAlignment.Stretch,
- //VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
- //TextWrapping = TextWrapping.Wrap,
- //AcceptsReturn = true,
- VisibleButtons = EditorDefinition?.VisibleButtons ?? RichTextEditorButtons.All
- };
- Editor.OnChanged += o => { CheckChanged(); };
- return Editor;
- }
- protected override string RetrieveValue()
- {
- return Editor.Text;
- }
- protected override void UpdateValue(string value)
- {
- Editor.Text = value;
- }
- }
- }
|