共用方式為


StandardDataFormats.StorageItems 屬性

定義

唯讀屬性,會傳回與檔案和資料夾) 之儲存專案格式對應的格式識別碼字串值 (。

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

屬性值

String

Platform::String

winrt::hstring

對應至檔案和資料夾) 之儲存體專案格式 (的格式識別碼字串值。

範例

此範例示範如何使用 StorageItems 屬性。 如需更多範例,請參閱 剪貼簿範例ShareTarget 範例

public async Task ActivateAsync(ShareTargetActivatedEventArgs args)
{
    ShareOperation shareOperation = args.ShareOperation;
    if (shareOperation.Data.Contains(StandardDataFormats.Text))
    {
        string text = await shareOperation.Data.GetTextAsync();

        // To output the text from this example, you need a TextBlock control
        // with a name of "sharedContent".
        sharedContent.Text = "Text: " + text;
    }

    if (shareOperation.Data.Contains(StandardDataFormats.StorageItems)) 
    {
        shareOperation.ReportStarted();
        IReadOnlyList<IStorageItem> storageItems = null;
        storageItems = await shareOperation.Data.GetStorageItemsAsync();
        string fileList = String.Empty;

        for (int index = 0; index < storageItems.Count; index++) 
        {
            fileList += storageItems[index].Name;
                if (index < storageItems.Count - 1) {
                    fileList += ", ";
                }
            }

        // To output the text from this example, you need a TextBlock control
        // with a name of "sharedContent".
        sharedContent.Text += "StorageItems: " + fileList + Environment.NewLine;

        shareOperation.ReportCompleted();
    }

    Window.Current.Content = this;
    Window.Current.Activate();
}

適用於