private static void ConvertRichTextBoxToGeometry(RichTextBox richTextBox, List <PathGeometry> pathList) { FlowDocument document = richTextBox.Document; if (!richTextBox.IsArrangeValid) { richTextBox.UpdateLayout(); } PathConversionHelper.ConvertTextRangeToGeometry(new TextRange(document.ContentStart, document.ContentEnd), richTextBox.FlowDirection, pathList); }
public static PathGeometry[] ConvertToPathGeometries(SceneElement element) { if (!PathConversionHelper.CanConvert(element)) { return(new PathGeometry[0]); } object platformSpecificObject = element.ViewObject.PlatformSpecificObject; ITypeId type = (ITypeId)element.ViewObject.GetIType((ITypeResolver)element.ProjectContext); List <PathGeometry> pathList = new List <PathGeometry>(); if (PlatformTypes.Shape.IsAssignableFrom(type)) { PathGeometry pathGeometry = PathConversionHelper.SimplifyGeometry(element.ViewModel.DefaultView.GetRenderedGeometryAsWpf(element), true, ProjectNeutralTypes.PrimitiveShape.IsAssignableFrom((ITypeId)element.Type)); pathList.Add(pathGeometry); } else if (platformSpecificObject is TextBlock) { TextBlock textBlock = platformSpecificObject as TextBlock; if (!textBlock.IsArrangeValid) { textBlock.UpdateLayout(); } PathConversionHelper.ConvertTextRangeToGeometry(new TextRange(textBlock.ContentStart, textBlock.ContentEnd), textBlock.FlowDirection, pathList); } else if (platformSpecificObject is RichTextBox) { PathConversionHelper.ConvertRichTextBoxToGeometry(platformSpecificObject as RichTextBox, pathList); } else if (platformSpecificObject is TextBox) { PathConversionHelper.ConvertTextBoxToGeometry(platformSpecificObject as TextBox, pathList); } else { PathConversionHelper.ConvertToPathGeometriesViaProxy(element as BaseFrameworkElement, pathList); } return(pathList.ToArray()); }