Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Add support for WPF (Windows Desktop) in a Xamarin.Forms solution

$
0
0

Tutorial Overview

In my latest tutorial we will create a cross-platform solution with Xamarin.Forms that includes WPF (Windows Desktop) as a target.
https://sites.google.com/site/netdeveloperblog/xamarin/forms/xamarin-forms-and-wpf

Cross-platform application development should reach the largest potential customer base it can. With Xamarin.Forms, you can create a solution with projects that target Android, iOS, Windows 10, Windows Mobile, Windows 8.1, and Windows Phone 8.1 out-of-the-box. Unfortunately, Windows Desktop is not included with this template. With so many people still using and relying on traditional Windows Desktop applications, many times it is important to provide a solution for that target environment.

Fortunately, with only a few modifications, we can refactor our default Xamarin.Forms solution to include a WPF project. Furthermore, we will establish a project structure that ensures all the projects can still utilized common code (things like View Models, Services, Models) from a PCL project within the solution.

We will cover the following activities:

  • Creating a new solution from the default Xamarin.Forms project template
  • Adding a Core PCL to our solution, to contain our common code
  • Add some common code to our Core PCL
  • Using a simple IoC container to replace Xamarin.Forms DependencyService class
  • Add a WPF project to our solution to target Windows Desktop
  • Implementing IHelloService in each platform
  • Creating some simple data binding in our MainPage and MainWindow views

Source Code

On GitHub: https://github.com/C0D3Name/XamFormsWpf
The source code for this tutorial can be found on my GitHub page.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>