正常綁定,編譯運行無報錯,但沒法執行commandexpress
fluentAPI.BindCommand(commandButton, (x, p) => x.DoSomething(p), x => parameter);
解決方法:
檢查command訪問權限,在devexpress規範中,command必須爲 public void
提示信息:All public void methods with zero or one parameter, declared in POCO ViewModels, are treated as commands.
在view層寫綁定的時候,經過alt+enter自動生成的command是Internal修飾的(程序集訪問權限),沒法訪問。this
internal void DoSomething(int p) {//將 internal改成public XtraMessageBox.Show(string.Format( "Hello! The parameter passed to command is {0}." + Environment.NewLine + "And I'm running, because the `canExecute` condition is `True` for this parameter." + Environment.NewLine + "Try to change this parameter!", p)); }
原文:https://blog.csdn.net/weixin_43862847/article/details/86766417
spa