WPF tree data binding model & repository
- by Am
Hi,
I have a well defined tree repository. Where I can rename items, move them up, down, etc. Add new and delete.
The data is stored in a table as follows:
Index    Parent   Label    Left    Right
1        0        root     1       14
2        1        food     2       7
3        2        cake     3       4
4        2        pie      5       6
5        1        flowers  8       13
6        5        roses    9       10
7        5        violets  11      12
Representing the following tree:
                       (1) root (14)
         (2) food (7)                  (8) flowers (13)
  (3) cake (4)  (5) pie (6)    (9) roeses (10) (11) violets (12)
or
root
  food
    cake
    pie
  flowers
    roses
    violets
Now, my problem is how to represent this in a bindable way, so that a TreeView can handle all the possible data changes?
Renaming is easy, all I need is to make the label an updatble field. But what if a user moves flowers above food? I can make the relevant data changes, but they cause a complete data change to all other items in the tree. And all the examples I found of bindable hierarchies are good for non static trees..
So my current (and bad) solution is to reload the displayed tree after relocation change.
Any direction will be good.
Thanks