©2018 by Hiran Peiris. Proudly created with Wix.com

  • Hiran Peiris

Social share with Xamarin.Forms

Today, I am going to teach you about Social sharing with Xamarin.Forms.

Technically, there is no inbuilt class or method to perform a social share  in Xamarin.Forms.

So, How we are going to do this.

Dependancy services ?

Yes, that’s the only way…

Lets create.

1. Create a Xamarin.Forms project.

2. Create a HomePage and set it as the MainPage in App.xaml.

3. Create following classes.

  • IShareService.cs in PLC project

  • ShareService.cs in .Droid project

  • ShareService.cs in .iOS project


ShareService.cs   in .Droid

ShareService.cs   in .iOS

Save all.

Now our SocialShare service is ready for use.

3.  Add a button with event handler in HomePage.

You can share,

Link, Youtube Video, Picture url or Text.

4. Compile and run on Android.

5. Compile and run on iOS.


Source code available in https://github.com/hiranpeiris/SocialApp

Happy coding.