0
votes

i am developing a windows 8 metro app in which i am sharing the HTML content from my windows 8 Metro App.

I want to share the HTML content and images at the same time using the share contract in c#/xaml windows 8 metro app

  protected override bool GetShareContent(DataRequest request)
        {
            bool succeeded = false;


                DataPackage requestData = request.Data;
               requestData.Properties.Title = TitleInputBox.Text;
                requestData.Properties.Description = DescriptionInputBox.Text;

//Sharing Images

           List<IStorageItem> imageItems = new List<IStorageItem>();
           imageItems.Add(this.imageFile);
           imageItems.Add(this.imageFile);
           imageItems.Add(this.imageFile);
           requestData.SetStorageItems(imageItems);

//Sharing HTML Content

           requestData.Properties.Title = "A web snippet for you";
           requestData.Properties.Description = "HTML selection from a WebView control";
           requestData.SetHtmlFormat(HtmlFormatHelper.CreateHtmlFormat("<h1>This
           is test</h1><br></br>checking it"));



             return succeeded;
         }

Here in the above code , if i want to trying to share html content and images at the same time.

but , by default it is taking only the first one (either images or html content which will be placed first) it is not able to share both at the same time.

i am able to share either images or html content at a time but not both ???

1) How can i share Html content and Images at the same time using share contract in windows 8 metro app ??

2)what are the various available ways in which i can share both at same time ??

Looking forward for your response

please let me know

1

1 Answers

0
votes

The way sharing in Windows 8 works is that you should populate the DataPackage with all the different sorts of data that make sense for your application and what's available to you (in this case Html and Storage Items).

Windows 8 then displays to the user any application that as registered to receive for at least one of the types of data in the package. So it may be the apps shown are registering for one of the data types you'e sharing but not the other.

Also it's completely up the receiving app what to do if it receives multiple types it support. Sometimes it makes sense for the app to use both, other times it may have some sort of priority stack for it's data.

Overall you're doing all you can in sending both forms of data but in the end it's completely up to the receiving app what it does with that data.