I am using mvvm in a wpf app. I have a ContextMenu inside of a listview and when I right click a listviewitem i want a contextmenu to display a list of Contacts.
The following just gives me a contextmenu with no content. Can anyone tell me what I'm doing wrong?
<ListView Grid.Row="3"
ItemsSource="{Binding Path=Phones}"
SelectedItem="{Binding Phones.SelectedItem}"
Height="100">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="ContextMenu" Value="{StaticResource ContactMenu}"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Header="Phone" DisplayMemberBinding="{Binding Path=PhoneNumber, StringFormat=(000) 000-0000}"/>
<GridViewColumn Header="Type" DisplayMemberBinding="{Binding Path=PhoneType.Type}"/>
<GridViewColumn Header="Contacts" DisplayMemberBinding="{Binding Path=Contacts.Count}"/>
<GridViewColumn Header="Notes" DisplayMemberBinding="{Binding Path= Notes.Count}"/>
<GridViewColumn Header="Priority" DisplayMemberBinding="{Binding Path=Priority}"/>
</GridView>
</ListView.View>
</ListView>
<UserControl.Resources>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Background" Value="{Binding SourceType, Converter={StaticResource SourceGroupConverter}}"/>
</Style>
<ContextMenu x:Key="ContactMenu" ItemsSource="{Binding Contacts}" >
<ContextMenu.ItemTemplate>
<DataTemplate>
<MenuItem Header="{Binding Path=FirstName}"/>
</DataTemplate>
</ContextMenu>
</UserControl.Resources>
UPDATE:
I figured it out, I had a specialized collection that caused the binding path to be incorrect.
Thanks.