Sharing to Facebook/Twitter from Windows 8/WinRT App

Sharing on "Metro style"/"Windows Store" app is a bit different from what we used to. Instead of invoking it directly in code, Microsoft encourages us to use the centralised "charm" bar where we would then implement a page event handler to fill in details to share.

To personalise share details, we would fill a DataPackage that would then be used across various media such as email or message or other apps.

To start, you can use

DataTransferManager.GetForCurrentView();

to get the current page's DataTransferManager. The instance has an event called DataRequested that you can respond to to fill in details whenever the user chooses to share something via the charms bar.