MVVM-Samples icon indicating copy to clipboard operation
MVVM-Samples copied to clipboard

Docs - Services in "Putting things together"

Open yoshiask opened this issue 5 years ago • 0 comments

The Putting things together page describes how to make and implement services, but it doesn't explain how to use them. The Building the UI section gives a sample, but it doesn't work.

  1. App.Current doesn't have a Services property. I discovered in #22 that you have to cast it like this ((App)Application.Current).Services to access it.
  2. The code included at the end of the previous section doesn't seem to set the Services property. When I tried the above fix in the constructor of my MainPage, Services was null.
  3. IServiceProvider doesn't have a GetService<T>() method in the latest version of Microsoft.Extensions.DependencyInjection (5.0.0). It seems to have been changed to GetService(Type serviceType).

yoshiask avatar Nov 26 '20 04:11 yoshiask