RibbonCommand was not found

前端 未结 3 1999
感动是毒
感动是毒 2021-02-10 09:42

I see the majority of WPF Ribbon examples out there use some code like

xmlns:r=\"clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary\         


        
3条回答
  •  花落未央
    2021-02-10 10:19

    You also can use ICommand to implement your own command.

    This class should be in code behind.

    public class MyCommand : ICommand
    {
        public void Execute(object parameter)
        {
            string hello = parameter as string;
            MessageBox.Show(hello, "World");
        }
    
        public bool CanExecute(object parameter)
        {
            return true;
        }
    
        public event EventHandler CanExecuteChanged;
    }
    

    You need to have Resources for using this command.

    
        
    
    

    You also need to modify your xaml element to call this command.

     
    

提交回复
热议问题