カウントをテキストブロックにバインドする際に問題があります。
アイテムが Users オブジェクトのプロパティにバインドされているというリストビューがあります。バインドされたすべてのアイテムの数を取得したい。
ここに私のリストビューがあります:
<ListView ItemsSource="{Binding Users}" x:Name="lvUsers">
<ListView.ItemTemplate>
<DataTemplate>
<ListViewItem IsHitTestVisible="False">
<StackPanel>
<facebookControls:ProfilePicture Height="74" Width="74" ProfileId="{Binding FacebookId}" />
<TextBlock Text="{Binding UserName}" FontSize="18" HorizontalAlignment="Center" />
</StackPanel>
</ListViewItem>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
そして、ここに私のTextBlockがあります:
<TextBlock Text="{Binding ElementName=lvUsers, Path=Items.Count, Mode=OneWay}" />
私は何を間違っていますか?
ListView に Templates がなく、ListViewItems のみの場合、機能することはわかっていますが、そのようにする必要があります。