Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
对象参数可以转换为枚举:
public void Execute(object parameter) { if (parameter is State s) { // do work; } else { throw new ArgumentException(nameof(parameter)); } }
您还应该从XAML正确传递,例如:
CommandParameter="{x:Static local:State.NeutralState}"
不仅是command> commandparameter =“ NeutralState”,它将通过字符串
command> commandparameter =“ NeutralState”
object parameter can be converted to enum:
you should also pass it correctly from XAML, e.g:
and not just CommandParameter="NeutralState", which will pass a string
CommandParameter="NeutralState"
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
对象参数可以转换为枚举:
您还应该从XAML正确传递,例如:
不仅是
command> commandparameter =“ NeutralState”
,它将通过字符串object parameter can be converted to enum:
you should also pass it correctly from XAML, e.g:
and not just
CommandParameter="NeutralState"
, which will pass a string