MVVM Dynamic Menu UI from binding with ViewModel

前端 未结 5 1260
南方客
南方客 2020-11-29 00:53

I am working with a team on LoB application. We would like to have a dynamic Menu control, which creates the menu based on the logged in user profile. In previo

5条回答
  •  忘掉有多难
    2020-11-29 01:26

    I know this is an old post but I need this plus how to bind Commands.

    As to Guge's question on how to bind Commands: VMMenuItems is a property in my view model class of type

    ObservableCollection
    

    and Menu is the class defined above. The MenuItem's Command Property is being bound to the Command Property of the Menu class. In my view model class

    Menu.Command = _fou
    

    where

    private ICommand _fou;
    

    The xaml

    
        
               
                    
                
                              
    
    

提交回复
热议问题