StandardDataFormats.StorageItems 속성

정의

스토리지 항목 형식(파일 및 폴더의 경우)에 해당하는 형식 ID 문자열 값을 반환하는 읽기 전용 속성입니다.

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

스토리지 항목 형식(파일 및 폴더의 경우)에 해당하는 형식 ID 문자열 값입니다.

예제

이 예제에서는 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();
}

적용 대상