C# 获取列表的属性<;存储文件>;

C# 获取列表的属性<;存储文件>;,c#,wpf,C#,Wpf,我正在尝试为我的mediaplayer制作播放列表。我有一个列表,需要获取它包含的名称,并将其设置为主窗口上的列表框。我有代码,但它只是将项目设置为Windows.Storage.StorageFile PlaylistBox.ItemsSource = Playlist; upd。我的wpf表格上有列表框,我需要用 List<StorageFile>.DisplayName List.DisplayName 但是我只有对象Windows.Storage.StorageFile

我正在尝试为我的mediaplayer制作播放列表。我有一个列表,需要获取它包含的名称,并将其设置为主窗口上的列表框。我有代码,但它只是将项目设置为Windows.Storage.StorageFile

PlaylistBox.ItemsSource = Playlist;
upd。我的wpf表格上有列表框,我需要用

List<StorageFile>.DisplayName
List.DisplayName

但是我只有对象Windows.Storage.StorageFile

在播放框上设置DisplayMemberPath属性

    <ListBox DisplayMemberPath="DisplayName" x:Name="PlaylistBox" />
或者您可以指定ItemTemplate

<ListBox>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text={Binding DisplayName}/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>


尤拉到底出了什么问题?您无法绑定它?Yura您可以添加更多信息吗?MSDN是您的朋友
<ListBox>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text={Binding DisplayName}/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>