ReactiveUI: Using CanExecute with a ReactiveCommand

前端 未结 2 2103
挽巷
挽巷 2021-01-07 07:33

I\'m starting to work with the ReactiveUI framework on a Silverlight project and need some help working with ReactiveCommands.

In my view model, I have something tha

2条回答
  •  萌比男神i
    2021-01-07 07:55

    I finally figured this one out. Using ReactiveCommand.Create() worked for my situation.

    MyViewModel()
    {
      AddNewRecord = ReactiveCommand.Create(x => MyCollection.Count < MaxRecords);
    
      AddNewRecord.Subscribe(x => 
      {
         MyCollection.Add("foo");
      }
    }
    

提交回复
热议问题