private static void ConvertToPathGeometriesViaProxy(BaseFrameworkElement frameworkElement, List <PathGeometry> pathList) { TextEditProxy editProxy = TextEditProxyFactory.CreateEditProxy(frameworkElement); IViewTextBoxBase editingElement = editProxy.EditingElement; UIElement uiElement = editingElement.PlatformSpecificObject as UIElement; if (uiElement == null) { return; } frameworkElement.DesignerContext.ActiveView.AddLiveControl((IViewControl)editingElement); editProxy.ForceLoadOnInstantiate = true; editProxy.Instantiate(); Rect computedTightBounds = frameworkElement.GetComputedTightBounds(); editingElement.Width = computedTightBounds.Width; editingElement.Height = computedTightBounds.Height; if (uiElement is RichTextBox) { PathConversionHelper.ConvertRichTextBoxToGeometry(uiElement as RichTextBox, pathList); } else if (uiElement is TextBox) { PathConversionHelper.ConvertTextBoxToGeometry(uiElement as TextBox, pathList); } frameworkElement.DesignerContext.ActiveView.RemoveLiveControl((IViewControl)editingElement); }
public TextBoxRangeElement Instantiate(TextEditProxy textEditProxy, SceneViewModel viewModel, ITypeId targetType) { ControlTextRangeElement textRangeElement = (ControlTextRangeElement)this.Instantiate(viewModel, targetType); textRangeElement.TextEditProxy = textEditProxy; return((TextBoxRangeElement)textRangeElement); }
public RichTextBoxRangeElement Instantiate(TextEditProxy textEditProxy, SceneViewModel viewModel, ITypeId targetType) { RichTextBoxRangeElement textBoxRangeElement = (RichTextBoxRangeElement)this.Instantiate(viewModel, targetType); textBoxRangeElement.TextEditProxy = textEditProxy; return(textBoxRangeElement); }
public void Undo() { TextEditProxy textEditProxy = this.designerContext.ActiveSceneViewModel.TextSelectionSet.TextEditProxy; if (textEditProxy != null) { if (textEditProxy.EditingElement.CanUndo) { if (!textEditProxy.EditingElement.CanRedo) { textEditProxy.Serialize(); textEditProxy.UpdateDocumentModel(); textEditProxy.EditingElement.Undo(); } else { textEditProxy.EditingElement.Undo(); return; } } else { this.designerContext.ActiveView.TryExitTextEditMode(); } if (!this.UndoService.CanUndo) { return; } } this.UndoService.Undo(); this.OnUndoRedoEditTransaction(); }
public static TextRangeElement CreateTextRangeElementFromProxy(TextEditProxy proxy) { if (proxy.SupportsParagraphProperties) { ITypeId targetType = PlatformTypes.Inline; return((TextRangeElement)RichTextBoxParagraphsRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, targetType)); } if (proxy.SupportsRangeProperties) { ITypeId targetType = PlatformTypes.Inline; return((TextRangeElement)RichTextBoxRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, targetType)); } if (PlatformTypes.TextBox.IsAssignableFrom((ITypeId)proxy.TextSource.Type) || PlatformTypes.AccessText.IsAssignableFrom((ITypeId)proxy.TextSource.Type)) { return((TextRangeElement)TextBoxRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, (ITypeId)proxy.TextSource.Type)); } return((TextRangeElement)ControlTextRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, (ITypeId)proxy.TextSource.Type)); }
public void Redo() { TextEditProxy textEditProxy = this.designerContext.ActiveSceneViewModel.TextSelectionSet.TextEditProxy; if (textEditProxy != null) { if (textEditProxy.EditingElement.CanRedo) { textEditProxy.EditingElement.Redo(); return; } this.designerContext.ActiveView.TryExitTextEditMode(); if (!this.UndoService.CanRedo) { return; } } this.UndoService.Redo(); this.OnUndoRedoEditTransaction(); }