Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metaljase/wpfappfetchingapidataexample

Example of a .NET WPF app displaying data (using XAML & MVVM) fetched from an ASP.NET Web API.
https://github.com/metaljase/wpfappfetchingapidataexample

api architecture asp-net asp-net-core asp-net-core-web-api aspnetcore csharp dependency-injection dotnet dotnet-core dotnetcore mvvm webapi webapi-core wpf wpf-application wpf-datagrid wpf-ui

Last synced: 3 days ago
JSON representation

Example of a .NET WPF app displaying data (using XAML & MVVM) fetched from an ASP.NET Web API.

Awesome Lists containing this project

README

        

# What is WpfAppFetchingApiDataExample?
WpfAppFetchingApiDataExample is an example of how a .NET WPF app can fetch data from an ASP.NET Web API and display it.

The .NET solution contains four projects, which include:
- ASP.NET Web API, based on the weather forecast project included with Visual Studio as a template.
- .NET WPF app to display the dummy weather forecast data from the API, using DI, MVVM and XAML.
- Class library for the WPF app.
- Class library for data access.

NOTE: Exception handling, resilient HTTP calls, proper logging etc, have been omitted on purpose to simplify this example.

# Setup instructions
1) Clone the WpfAppFetchingApiDataExample repository.

2) Open the .NET solution in Visual Studio 2022 (or a compatible alternative).

3) Set both `WpfApiDataExample.DataManager.Api` and `WpfApiDataExample.UI.Wpf` as startup projects.

4) Build the solution and run.

5) The API should open in a web browser window. Make a note of the URL, and stop the app.

6) Open `appsettings.json` in `WpfApiDataExample.UI.Wpf` and update `ApiBaseUrl` with the URL from the previous step.

7) Build the solution and run.

8) The API should open in a web browser and also the WPF app should open displaying the weather forecast.