this.WhenyAny is not working for me when I try to check the count of ObservableCollection.
SampleCommand = new ReactiveCommand(this.WhenAny(c => c.TaskList, ((task) => task.Value != null && task.Value.Count > 0)));
......
private ObservableCollection<Task> _taskList;
public ObservableCollection<Task> TaskList
{
get { return _taskList; }
set { this.RaiseAndSetIfChanged(ref _taskList, value); }
}
I believe the condition is never satisfied as the functionality inside the command is never executed.
My original requirement is whenever the properties of this collection changes, I want to assign it to ObservablePropertyHelper type- isTaskUpdationInitiated. I have implemented the same as below
this.WhenAny(x => x.TaskList, (z) => z.Value.Count > 0 && ( z.Value.Any(y =>
( y.Id == TaskId && y.Prop1 != MyProp1Value &&
y.Prop2 != MyProp2Value && y.Prop3 != MyProp3Value)
))).ToProperty( this, x=>x.IsTaskUpdationInitiated , out isTaskUpdationInitiated );
So whenever these conditions are satisfied, isTaskUpdationInitiated should be set to true. As this was not working, i tried a sample code that I have given intially. Please help!