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.
From stackoverflow
-
Can you use
ChildVisual = VisualTreeHelper.GetChild(Visual yourVisual)
Dunno if you can take a Visual and turn it into a path geometry..
-
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
Dmitri Nesteruk : 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. -
A
FlowDocument
can be viewed in any number of ways, but aPath
is a fixed shape. I think maybe you really want some simplified, visual-only form of aFlowDocument
's contents.In that case you might try converting the
FlowDocument
to an XPSFixedDocument
- theFixedPage
s haveCanvas
es containing a bunch ofPath
s andGlyph
s.
0 comments:
Post a Comment