You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating a fully generic file explorer for AvaloniaUI. It has a view that shows a folder tree that you can navigate by expanding each directory.
My goal is to make this view flexible enough to support selecting multiple items from multiple nodes.
The problem? The tree is dynamic. Not only are the children lazily loaded, but also the user can potentially create new items (like folders), and select them.
I currently have a IFileItem interface to represent the items in the file structure. I have Folder and File currently.
Folders can have other entries (folders + files), of course.
Both File and Folder are ViewModels (even though I'm not adding the ViewModel suffix 😁)
The SelectedItems property should hold a list of whatever it's selected in a given branch, this is, the given node + the children.
This approach could be useful, and might be what I need, but I'm not sure how well is this solution for supporting scenarios like single folder picking.
Now the question: How do we define the SelectedItems property???
It should watch change of this.IsSelected AND Children.IsSelected RECURSIVELY. Now that's hard.
I'm not familiarized with any use case like this in DynamicData, but I think it should be handled. For now, I'm completely stuck.
I hope someone could come with a nice solution in a purely DD way :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm creating a fully generic file explorer for AvaloniaUI. It has a view that shows a folder tree that you can navigate by expanding each directory.
My goal is to make this view flexible enough to support selecting multiple items from multiple nodes.
The problem? The tree is dynamic. Not only are the children lazily loaded, but also the user can potentially create new items (like folders), and select them.
IFileItem
interface to represent the items in the file structure. I haveFolder
andFile
currently.To support the selection feature, my plan is to add a property
ReadOnlyObservableCollection<IFileItem> SelectedItems
:The
SelectedItems
property should hold a list of whatever it's selected in a given branch, this is, the given node + the children.This approach could be useful, and might be what I need, but I'm not sure how well is this solution for supporting scenarios like single folder picking.
Now the question: How do we define the
SelectedItems
property???It should watch change of this.IsSelected AND Children.IsSelected RECURSIVELY. Now that's hard.
I'm not familiarized with any use case like this in DynamicData, but I think it should be handled. For now, I'm completely stuck.
I hope someone could come with a nice solution in a purely DD way :)
Big thanks to everyone reading!
Beta Was this translation helpful? Give feedback.
All reactions