/// <inheritdoc/> public override void SetModel(TextToolbar model) { base.SetModel(model); CommonButtons = new CommonButtons(model); ButtonActions = new RichTextButtonActions(this); }
/// <summary> /// Sets the <see cref="TextToolbar"/> where the Formatter is used /// </summary> /// <param name="model">The <see cref="TextToolbar"/> where Formatter is used</param> public virtual void SetModel(TextToolbar model) { if (Model != null) { Model.EditorChanged -= Model_EditorChanged; } Model = model; Model.EditorChanged += Model_EditorChanged; }
public void OnXamlRendered(FrameworkElement control) { _toolbar = control.FindChild("Toolbar") as TextToolbar; if (control.FindChild("EditZone") is RichEditBox editZone) { editZone.TextChanged += EditZone_TextChanged; } if (control.FindChild("Previewer") is MarkdownTextBlock previewer) { _previewer = previewer; _previewer.LinkClicked += Previewer_LinkClicked; } }
public void OnXamlRendered(FrameworkElement control) { _toolbar = control.FindChildByName("Toolbar") as TextToolbar; var editZone = control.FindChildByName("EditZone") as RichEditBox; if (editZone != null) { editZone.TextChanged += EditZone_TextChanged; } _previewer = control.FindChildByName("Previewer") as MarkdownTextBlock; if (_previewer != null) { _previewer.LinkClicked += Previewer_LinkClicked; } }
public async Task Init() { await App.Dispatcher.ExecuteOnUIThreadAsync(() => { var richEditBox = new RichEditBox { PlaceholderText = "Enter Text Here", TextWrapping = TextWrapping.Wrap, VerticalContentAlignment = VerticalAlignment.Stretch, MinHeight = 300, BorderThickness = new Thickness(1), SelectionFlyout = null }; _textToolbar = new TextToolbar { Editor = richEditBox, IsEnabled = true, Format = Microsoft.Toolkit.Uwp.UI.Controls.TextToolbarFormats.Format.RichText }; var grid = new Grid { Children = { _textToolbar, richEditBox }, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Height = 200, Width = 300 }; grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition()); TestsPage.Instance.SetMainTestContent(grid); Grid.SetRow(richEditBox, 1); }); }
public void OnXamlRendered(FrameworkElement control) { _toolbar = control.FindChildByName("Toolbar") as TextToolbar; if (control.FindChildByName("EditZone") is RichEditBox editZone) { editZone.TextChanged += EditZone_TextChanged; } if (control.FindChildByName("Previewer") is MarkdownTextBlock previewer) { _previewer = previewer; _previewer.LinkClicked += Previewer_LinkClicked; } if (ToolbarFormat != null && (Format)ToolbarFormat.Value == Format.Custom) { UseCustomFormatter(); } }
/// <summary> /// Initializes a new instance of the <see cref="CommonButtons"/> class. <para/> /// Requires a TextToolbar Instance />. /// </summary> /// <param name="model">TextToolbar Instance</param> public CommonButtons(TextToolbar model) { Model = model; }
/// <summary> /// Initializes a new instance of the <see cref="RichTextFormatter"/> class. /// </summary> /// <param name="model">The <see cref="TextToolbar"/></param> public RichTextFormatter(TextToolbar model) : base(model) { CommonButtons = new CommonButtons(model); ButtonActions = new RichTextButtonActions(this); }
/// <summary> /// Initializes a new instance of the <see cref="MarkDownFormatter"/> class. /// </summary> /// <param name="model"><see cref="TextToolbar"/> where formatter will be used</param> public MarkDownFormatter(TextToolbar model) : base(model) { CommonButtons = new CommonButtons(model); ButtonActions = new MarkDownButtonActions(this); }
/// <summary> /// Initializes a new instance of the <see cref="Formatter"/> class. /// </summary> /// <param name="model">The <see cref="TextToolbar"/>where Formatter is used</param> public Formatter(TextToolbar model) { Model = model; Model.EditorChanged += Model_EditorChanged; }
public override void SetModel(TextToolbar model) { base.SetModel(model); CommonButtons = new CommonButtons(model); }
/// <summary> /// This method is called to unset event handlers that might have been registers by <see cref="SetModel(TextToolbar)"/> /// </summary> /// <param name="model">The old <see cref="TextToolbar"/> the Formatter was associated with</param> public virtual void UnsetModel(TextToolbar model) { model.EditorChanged -= Model_EditorChanged; }
public SampleFormatter(TextToolbar model) : base(model) { CommonButtons = new CommonButtons(model); }