• MVVM ICommand.CanExecute parameter is null


    CommandParameter="{Binding}"

    改为

    CommandParameter="{Binding DataContext,RelativeSource={RelativeSource Self}}"
                                <StackPanel Orientation="Horizontal" >
                                    <Button Content="×" CommandParameter="{Binding DataContext,RelativeSource={RelativeSource Self}}" Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CmdConvertToFalse}"></Button>
                                    <Button Content="√" CommandParameter="{Binding DataContext,RelativeSource={RelativeSource Self}}" Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.CmdConvertToTrue}"></Button>
                                </StackPanel>
  • 相关阅读:
    go语言的垮平台编译
    vscode使用技巧
    集合
    泛型
    异常
    Java垃圾回收机制
    java学习笔记9.20
    java变量类型
    目前的学习计划
    离第一篇博客三天
  • 原文地址:https://www.cnblogs.com/rock_chen/p/10239513.html
Copyright © 2020-2023  润新知