Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
F

Flowent57

@Flowent57
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • WPF MVVM Dispose ViewModel
    F Flowent57

    Hi, I have a treeview with one root node. This node has some children. The root not is a "TreeViewItemViewModel". This class contains : "ObservableCollection<TreeViewItemViewModel> Items" which are Children nodes. At beginning, the root node is not expanded and "Children" is empty. When I expand root node, I load data from DataBase in Children collection :

    public override void LoadChildren()
    {
    this.Items.Clear();
    List lstOp = DataBAse.GetAllOperations();
    foreach (Operation op in lstOp)
    {
    this.Items.Add(new TreeViewItemViewModel(op));
    }
    }

    If I "unexpand" and expand the root node, I reload children...

    public bool IsExpanded
    {
    get
    {
    return _isExpanded;
    }
    set
    {
    if (value != this._isExpanded)
    {
    this._isExpanded = value;
    RaisePropertyChanged("IsExpanded");

                    if (this.\_isExpanded)
                    {
                        this.LoadChildren();
                    }
                }
            }
        }
    

    My issue : when I call "LoadChildren", Items list is cleared but viewmodel are always in memory... Can someone help me ?

    C# wpf help csharp database architecture
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups