I have the following XAML used to populate a sub-MenuItem listing with RecentDocuments:
<MenuItem Header="_Recent Studies"
ItemsSource="{Binding RecentFiles}"
AlternationCount="{Binding Path=Items.Count,
Mode=OneWay,
RelativeSource={RelativeSource Self}}"
ItemContainerStyle="{StaticResource RecentMenuItem}"/>
Where in the ViewModel I have the following RecentFiles
property
private ObservableCollection<RecentFile> recentFiles = new ObservableCollection<RecentFile>();
public ObservableCollection<RecentFile> RecentFiles
{
get { return this.recentFiles; }
set
{
if (this.recentFiles == value)
return;
this.recentFiles = value;
OnPropertyChanged("RecentFiles");
}
}
Now this works fine and displays my recent menu items like so:
My question is; how can I bind to the click event on my recent files MenuItem
s? I am amble to use AttachedCommands
but I don't see how this can be achieved.
thanks for your time.