StandardDataFormats.Html Propriété

Définition

Propriété en lecture seule qui renvoie la valeur de chaîne d’ID de format correspondant au format HTML.

public:
 static property Platform::String ^ Html { Platform::String ^ get(); };
static winrt::hstring Html();
public static string Html { get; }
var string = StandardDataFormats.html;
Public Shared ReadOnly Property Html As String

Valeur de propriété

String

Platform::String

winrt::hstring

Valeur de chaîne d’ID de format correspondant au format HTML.

Exemples

Cet exemple illustre l’utilisation de la propriété Html . Pour utiliser le code de cet exemple, ajoutez un écouteur d’événements à votre application pour gérer l’événement activé . Ensuite, placez ce code dans la fonction que cet écouteur d’événement appelle.

public void ShareSourceLoad()
{
    DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
    dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);
}

async void DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
    string htmlExample = "<p>Here is our store logo: <img src='assets/logo.png'>.</p>";
    string fileExample = "assets\\logo.png";
    RandomAccessStreamReference streamRef = null;
    Windows.Storage.StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(fileExample);
    try
    {
        streamRef = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(file);
    }
    catch (Exception ex)
    {
        // TODO: Handle the exception.
    }
    string htmlFormat = Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.CreateHtmlFormat(htmlExample);
    DataRequest request = e.Request;
    request.Data.Properties.Title = "Share HTML Example";
    request.Data.Properties.Description = "An example of how to share HTML.";
    request.Data.SetHtmlFormat(htmlFormat);
    request.Data.ResourceMap[fileExample] = streamRef;
}

S’applique à