[β οΈ JOURNEY] Building MP3 AI Manager for Music Hoarders (Day 22)
Day 22
Hours worked/Total: 8/54
Day Recap
Made significant progress on enhancing the TreeView component with icons, recursive subnode generation, and styling. Successfully implemented dynamic tree regeneration on user interaction.
What I Did
- Added icons to TreeView items:
- Integrated the SkiaSharp.Svg package to render SVG icons for files and folders.
- Implemented recursive subnode population:
- Designed a recursive object structure to support nested subnodes.
- Updated the tree dynamically to reflect subnodes for selected nodes.
- Faced major challenges with Avalonia’s styling system:
- Limited ability to identify source controls or bind styles dynamically.
- Two-way bindings between custom properties or ViewModel functions weren’t straightforward.
- Solved the issue by listening to click events:
- Traversed the XML control tree to locate the parent component.
- Used DataContext to access the associated model/ViewModel.
- After many hours of debugging, made it possible to trigger recursive tree regeneration based on user interaction.
Remarks
This was a long and frustrating day, but the result is a functional and dynamic TreeView. Avalonia’s rigid styling and event-handling mechanisms required a deep dive to achieve even basic interactivity.
While the approach to traversing the control tree feels hacky, it works and ensures accurate node identification and updates. This effort has improved the TreeView’s responsiveness and paved the way for future features.
Next Goals
Add lazy loading for subnodes to reduce memory usage for large file structures.