Error in user YAML: (<unknown>): did not find expected key while parsing a block mapping at line 1 column 1
---
title: How do I change the “This app can’t share” message?
authors:
- thebeebs
intro: 'If you build a windows 8 application and don't imp...'
types:
- shorts
categories:
- win8at8
published: 2012/08/02 12:00:00
updated: 2012/08/02 13:00:00
status: archived
---
If you build a windows 8 application and don't implement sharing on a specific page, when a user presses the Windows 8 share charm the default text that is displayed says "This app can't share" it maybe the case that other pages can share or that you plan to add sharing into a future version so changing this text is useful to give the user more information. For example you might want to say "You can't share right now, select a news story and then try again".
To do this we wire up the share contract as we normal would, but rather than providing a dataTransfer object we set the failWithDisplayText.
var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView(); dataTransferManager.addEventListener("datarequested", dataRequested);function dataRequested(e) { var request = e.request; request.failWithDisplayText("Select a news story and then try again"); }