-
Notifications
You must be signed in to change notification settings - Fork 802
Description
Summary
Adding a ".Tag()" method/property to the TreeViewNode's. This way we can identify them a different way than just the content.
Rationale
Consider this: when you’re building a c++ app without XAML (while this is "not preferred" by most, my team does this), you end up writing A LOT of messy code just to link data to nodes. Think something like: either write a lot of wrappers for stuff (example concept shown below) or use very unique content for each tree view node (e.g. "1. This is bob's tree view node" "2. This is Angie's tree view node"). Without .Tag(), we’re stuck reinventing the wheel for something every other UI control already does. Why?
Earlier mentioned "Wrappers":
struct TSubTreeViewNodeWrapper {
std::wstring tag;
TreeViewNode& node;
};
struct TRootTreeViewNodeWrapper {
std::wstring tag;
TreeViewNode& node;
std::vector<TSubTreeViewNodeWrapper> children;
};Scope
| Capability | Priority |
|---|---|
| Allow attaching an IInspectable (Object for C#? -- don't know, don't code in it) to a TreeViewNode without extra wrappers | Must |
| Include a TagChanged event to notify when the tag updates | Could |
| Provide basic thread safety for tag access (e.g., std::lock/SRWLock) | Should |
Important Notes
Example usage:
TreeViewNode node;
node.Tag(myCustomData); // Set
IInspectable data = node.Tag(); // RetrieveAPI proposal:
Add a "Tag" property to the TreeViewNode class. This keeps code clean and avoids hacks like unique content or maintaining separate wrappers.
Open Questions
None for now.