Boolean CommandParameter in XAML

后端 未结 6 1082
忘掉有多难
忘掉有多难 2020-12-05 09:35

I have this code (which works just right):


             


        
6条回答
  •  不知归路
    2020-12-05 09:45

    This might be a bit of a hack but you can derive from the KeyBinding class:

    public class BoolKeyBinding : KeyBinding
    {
        public bool Parameter
        {
            get { return (bool)CommandParameter; }
            set { CommandParameter = value; }
        }
    }
    

    Usage:

    
    

    And another not so weird solution:

    xmlns:s="clr-namespace:System;assembly=mscorlib"
    
    
        
        True
        False
    
    

    Usage:

    
    

提交回复
热议问题