Skip to content
Dmitry Shechtman edited this page Mar 26, 2017 · 1 revision
  1. Derive your view model from AsyncBindableBase:

    using Ditto.AsyncMvvm;
    
    class UniversalAnswerViewModel : AsyncBindableBase
    {
    }
  2. Implement the asynchronous method for calculating the value of the property:

        private async Task<int?> GetAnswerAsync()
        {
            await Task.Delay(TimeSpan.FromDays(7500000 * 365.25));
            return 42;
        }
  3. Define the property:

        public int? Answer
        {
            get { return Property.Get(GetAnswerAsync); }
        }

Done!

Clone this wiki locally