Hierarchical object model with property inheritance and event bubbling?
- by Winston Fassett
I'm writing a document-based client application and I need a DOM or WPF-like, but non-visual model that:
Is a tree composed of elements
Can accept an unlimited number of custom properties that
get/set any CLR type, including collections.
Can inherit their values from their parent
Can inherit their default values from an ancestor
Can be derived/calculated from other properties, ancestors, or descendants
Support event bubbling / tunneling
There will be a core set of properties but other plugins may add their own or even create custom documents
Supports full inspection by the owning document in order to persist the tree and attributes in an XML format.
I realize that's a tall order but I was really hoping there would be something out there to help me get started. Unfortunately WPF DependencyObjects are too closed, proprietary, and coupled to WPF to be of any use as a document model. My needs also have a strong resemblance to the HTML DOM but I haven't been able to find any clean DOM implementations that could be decoupled from HTML or ported to .NET.
My current platform is .NET/C# but if anyone knows of anything that might be useful for inspiration or embedding, regardless of the platform, I'd love to know.