我有一个ObservableCollection
Team
中的一个(ObservableCollection<Team>)
。在我的Team
类中,有一个ObservableCollection
的“演员”(ObservableCollection)。现在,我要以mvvm模式在Listview
中显示演员。
有人解决吗?我没有在Google上找到任何内容可以在我的Listview
中显示演员。
谢谢。
<Window x:Class="Room.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Room.Views"
xmlns:localBind="clr-namespace:Room.ViewModels"
mc:Ignorable="d"
Title="" Height="300" Width="800">
<Window.DataContext>
<localBind:MainViewModel/>
</Window.DataContext>
<Grid>
<ListView Margin="10" ItemsSource="{Binding Teams}"
SelectedItem="{Binding Selectedactor}" >
<ListView.View>
<GridView>
<gridviewcolumn Header="Id" Width="80" DisplayMemberBinding="{Binding Id}"/>
<gridviewcolumn Header="Niggname" Width="160"
DisplayMemberBinding="{Binding Name}" />
</GridView>
</ListView.View>
</ListView>
</Grid>