Can this be achieved more elegantly with databinding?
-
08-06-2023 - |
문제
In one application I have developed I am storing data in custom objects (I call these files). These objects have quite a few properties.
The files are sorted into groups. I display certain properties of the files in a ListView control with Groups enabled.
I am storing the files in a Dictionary(Of String, List(Of MyFile))
, where String
is the group name.
The user is able to move files form one group to another, sort groups, move files in a group up and down, add and delete files and so on.
Currently I am doing this all by hand. I manually add the files to the group and synchronize the listview and the stored files whenever the user changes anything.
This gets very messy, very quickly and I don't like my approach. It works currently but it is a nightmare to change and maintain.
I know only little about data binding. I have tried it a some times but I found it equally clumsy. So I am currently looking for pointers for a data structure that allows me to maintain this kind of database with groups of object-lists and always let the user interact with the list in some way.
Leads that are helpful, for example:
- Is a Dictionary(Of Group, List(of Objects)) a good way to store this kind of data or are there better alternatives? There can be hundreds of files in multiple groups.
- Is a ListView a good tool or are there better alternatives?
- What is the best way to synchronize a data structure with a user interface?
I am developing a WinForms application.
If the question is too broad in its current form please leave a comment so I can add to the specific problem.
올바른 솔루션이 없습니다