Viet Phan X

[⚠️ JOURNEY] Building MP3 AI Manager for Music Hoarders (Day 22)

Author AvatarViet Phan
0
Jan 16, 2025
2 min read

Day 22

Hours worked/Total: 8/54

Avaloniatreeviewstyle

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.

πŸ‘¨β€πŸ’» Software DevelopmentπŸš€ Journey

Got an Idea?

Let's Build It!

I can bring your ideas to life - FREE of charge

Book a free consultation and let’s identify opportunities to turn your vision into a successful business

15 min call

Get idea feedback

from 17+ consultations
?
Usually responds within 24h

If You Like what I do
You can buy me a coffee πŸ‘‡
Send β˜• via PayPalSend β˜• with Bitcoin

πŸ€™ Let's connect

Made by Viet Phan Β© 2018-2025Privacy Policy