Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I am developing simple windows phone 8.1 app using C# and XAML.
I have command bar in which i have one share button and contact support, follow me.
HTML
<Page.BottomAppBar>
        
        <CommandBar x:Name="appBar" removed="White" Foreground="Black">
            <CommandBar.PrimaryCommands>
                <AppBarButton Icon="PostUpdate" IsCompact="False" Label="Share" Click="AppBarButton_Click_3"/>               
            </CommandBar.PrimaryCommands>
            <CommandBar.SecondaryCommands>
                <AppBarButton Label="contact support" />
                <AppBarButton Label="follow me" />                
            </CommandBar.SecondaryCommands>
        </CommandBar>
        
    </Page.BottomAppBar>

C#
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    DataTransferManager _dataTransferManager = DataTransferManager.GetForCurrentView();
    _dataTransferManager = DataTransferManager.GetForCurrentView();
    _dataTransferManager.DataRequested += OnDataRequested;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
    // Unregister the current page as a share source.
    DataTransferManager _dataTransferManager = DataTransferManager.GetForCurrentView();
    _dataTransferManager.DataRequested -= OnDataRequested;
}
private void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
    e.Request.Data.Properties.Title = "Hi!";
    e.Request.Data.SetUri(new Uri("http://www.google.com"));
}
private async void AppBarButton_Click_3(object sender, RoutedEventArgs e)
{
    DataTransferManager.ShowShareUI();
}

Following thing i want to do:
1.) Url which i entered to share in status is not showing.
2.) when click on contact support it goes to only emails list share options and when user select any of his email then it opens compose email and fill my email id at "Send to", subject="Hello", and some phone details like Device brand, modal, operator, firmware version, hardware version etc.
3.) When user click on follow me then user is redirected to my twitter account page in Internet explorer.
Posted
Updated 13-Aug-14 7:36am
v2
Comments
johannesnestler 14-Aug-14 8:47am    
sounds good - any questions or problems?
Raj Negi 14-Aug-14 9:09am    
I listed my 3 problems in the end.
johannesnestler 14-Aug-14 10:54am    
so I overlooked the question marks? No, sorry for joking... Just wanted to give you a hint how to improve your question since you didn't get any answers. I felt you should ask a clear question (I only can talk for me, but if someone asks for features, I'll solve it only for money). So nr. 1 is the problem you have, nr. 2,3 is the way you want it but you don't know how, correct?
Raj Negi 14-Aug-14 12:33pm    
yes u are right...but i am pretty sure it's answer include just a 2-3 line of code. Its a very basic and easy thing for a window phone app developer. I am new to windows phone app developing thats why i am facing problem initailly and 8.1 sdk is launched recently so its very difficult to find answers easily. I think there are very few developers of windows phone 8.1 using this forum. If i asked the same question for android app then surely be i got more response to my question.
johannesnestler 15-Aug-14 2:39am    
You are maybe right about lack of WP8.1 developers - I like the platform too, but can't find the time to do any development for it now... I'd love to help you with that, but I don't know the answers - maybe try the Microsoft forums?

Answer for 3rd question:
HTML
<appbarbutton label="follow me" click="AppBarButton_Click_2" />

C#
private async void AppBarButton_Click_2(object sender, RoutedEventArgs e)
        {
            // The URI to launch
            string uriToLaunch = @"https://twitter.com/youraccounturl";
            // Create a Uri object from a URI string 
            var uri = new Uri(uriToLaunch);
            await Windows.System.Launcher.LaunchUriAsync(uri);
        }
 
Share this answer
 
Please check official docs: https://msdn.microsoft.com/es-es/library/windows/apps/xaml/hh973056.aspx[^]

There you can see how to share a link.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900