-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please add properties to WPF for traversing Parent/Children nodes #10095
Comments
Can you please clarify what you have and what you are missing? DepdencyObject does not have children or parents. You can use VisualTreeHelper to navigate the visual tree. |
I'm trying to write converters from a selection within a WPF It would be very desirable to be able to traverse through the WPF DOM like browsing through other DOMs, like XML and HTML. The |
It would also be very helpful to have a |
Can you give examples of these methods? |
That's the same as asking there to be a general |
Also what is wrong with doing the conversion from XAML? Even when you want to save the selection as RTF, it serializes to XAML and then does XAML to RTF. Furthermore the XAML structure will be very similar to HTML structure, so you likely need to do minimal changes to it, and it takes care of things like inherited properties. (Note you wouldn't use |
Sure, see
You are right, I have been too general in my second comment above. Instead, though, I feel it would be reasonable for many classes, particularly the WPF document classes, to implement the Copying/modifying document elements is way too complicated at the moment. This is particularly true as these classes don't implement common interfaces.
That's what I'm actually doing right now.
What's wrong is that it doubles execution time by first converting an in-memory object tree into XAML and then, in a second iteration, into another format. Serializing into XAML requires exactly the same steps as serializing into any other format would require (except for plain text). So this is a sluggish, non-performant solution, particularly for larger documents. |
I'm trying to write a converter to convert a text selection from
FlowDocument
to some other text format.Current Situation
Currently, this is impossbile as all the navigating methods and properties are internal to the WPF framework.
The only workaround is to serialize the selected nodes to XAML using a
XamlWriter
and using anXmlReader
or similar to traverse the generated XML.The current solution is very cumbersome, slow, memory intensive and unnecessary.
Desired Situation
Please add
Parent
andChildren
properties to theDependencyObject
class, so we can traverse through any WPF object tree.The text was updated successfully, but these errors were encountered: