开发者

WP7 - Share Button like Marketplace and Pictures

Is there an easy way to create a Share button or link in WP7, like in the Marketplace when you click an app, or like when you view Pi开发者_C百科ctures. I want to be able to share data/link about something in my app ... on Facebook, email, whatever.


why do you not use the connected networks from the OS?

create a button with XAML, for example:

<Button Content="share" Grid.Row="1" Name="shareButton" Click="shareButton_Click"/>

Something like this for the click event:

 private void shareButton_Click(object sender, RoutedEventArgs e)
    {
        var url = String.Format(Your Item here);
        ShareLinkTask shareLinkTask = new ShareLinkTask();
        shareLinkTask.LinkUri = new Uri(url, UriKind.Absolute);
        shareLinkTask.Title = postTitleTxt.Text;
        shareLinkTask.Message = "Your Text here: " + postTitleTxt.Text;
        shareLinkTask.Show();
     }

For Email you can use this:

private void sendEmail(object sender, RoutedEventArgs e)
    {
        EmailComposeTask emailAuthor = new EmailComposeTask();
        emailAuthor.To = "whoever@hotmail.com";
        emailAuthor.Subject = "message from my App";
        emailAuthor.Body = "Text";
        emailAuthor.Show();
    }

hope this helps.


You should check "Launchers and Choosers". A Launcher is an API that launches one of the built-in applications like composing an email, sharing a link on a social network, and opening the browser to a specific website

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜