Can someone tell me how to get path geometry from a WPF FlowDocument object? Please not that I do not want to use FormattedText
. Thanks.
views:
769answers:
4
A:
Can you use
ChildVisual = VisualTreeHelper.GetChild(Visual yourVisual)
Dunno if you can take a Visual and turn it into a path geometry..
Cory R. King
2008-09-17 20:33:54
+1
A:
Get the Text property of a TextRange object initialized over the entire FlowDocument:
FlowDocument myFlowDocument = new FlowDocument(); //get your FlowDocument
//put in some (or it already has) text
string inText = "Hello, WPF World!";
TextRange tr = new TextRange(FlowDocument.ContentStart, FlowDocument.ContentEnd);
tr.Text = inText;
//get the current text out of the FlowDocument
TextRange trPrime = new TextRange(FlowDocument.ContentStart, FlowDocument.ContentEnd);
string outText = trPrime.Text;
//now outText == "Hello, WPF World!";
//to get formatting, looks like you would use myFlowDocument.TextEffects
Tim Erickson
2008-09-17 21:11:29
This doesn't seem to be exactly what we're after. I'd like Path information, not just text. I'm not interested in using FormattedText as a converter.
Dmitri Nesteruk
2008-12-04 17:11:58
A:
A FlowDocument
can be viewed in any number of ways, but a Path
is a fixed shape. I think maybe you really want some simplified, visual-only form of a FlowDocument
's contents.
In that case you might try converting the FlowDocument
to an XPS FixedDocument
- the FixedPage
s have Canvas
es containing a bunch of Path
s and Glyph
s.
Robert Macnee
2009-03-12 19:58:05