コード例 #1
0
        public ItemViewModel(RootViewModel root, int value)
        {
            Value       = value;
            _isSelected = false;

            Commands = new DynamicRelayCommandDictionary()
            {
                ParameterDicConverter = new ParameterDicConverterBase(((pm, pms) => new ParameterDic()
                {
                    { "RootVM", root },
                    { "ItemVM", this },
                    { "Parameter", pm }
                }), ((pm, pms) => null)),
                ScriptRunner = new ScriptRunner()
            };

            Commands.AddOne      = TestRelayCommands.ModifyValueCommand("{ItemVM}", 1);
            Commands.SubtractOne = TestRelayCommands.ModifyValueCommand("{ItemVM}", -1);
            Commands.MouseEnter  = ScriptCommands.PrintDebug("MouseEnter -> {ItemVM.Value}");
        }
コード例 #2
0
 public void AddNumber(int number)
 {
     Items.Add(new ItemViewModel(this, number));
     Commands.Clear = TestRelayCommands.ClearCommand("{RootVM}",
                                                     ScriptCommands.PrintDebug("Added clear command"));
 }