Csla.Xaml.ViewModelBase misunderstanding ??

Csla.Xaml.ViewModelBase misunderstanding ??

Old forum URL: forums.lhotka.net/forums/t/11498.aspx

st3fanus posted on Monday, July 23, 2012

Hi all

I have made a test app follow ebooks series part UI

My test app is Silverlight 5

I want to display a child window which is contain a ListBox that I want to display a list of menu on it.

BUT The First Temptation is NOT WORKED !

[ First Temptation ]

This is My Caller Code OR Initial Code :

            View.Sample dlg = new View.Sample();
            dlg.DataContext = new Menu.MenuVM(Csla.ApplicationContext.User.Identity.Name);

And this is My View Model

public MenuVM(string username)

      BeginRefresh(callback=>MenuList.GetMenuList(username, callback);

protected override void OnModelChanged(MenuList oldValue, MenuList newValue)
            base.OnModelChanged(oldValue, newValue);
            if (newValue != null)
                newValue.CollectionChanged += (sender, args) => OnPropertyChanged("MenuItemList");

And this is my property i bounded to ListBox

public ObservableCollection<MenuItemVM> MenuItemList
                if (Model == null)
                    return null;
                    return new ObservableCollection<MenuItemVM>(
                        Model.Select(t => new MenuItemVM(t, this)));

BUT The result is display nothing

[ Second Temptation]

I Display list of menu in the ListBox that is located in SAME View as Initial Caller

in the My Caller View Model I have a property :

public Menu.MenuVM MenuVM
        { get; private set; }

My Caller Code :

            MenuVM = new Menu.MenuVM(Csla.ApplicationContext.User.Identity.Name);




Could anyone help me to rxplain me ?


thanks a lot







Copyright (c) Marimer LLC