List で IValueConverter を使用できます。初めてメニューを呼び出すときに使用できます。リスト内のアイテムを更新すると、IValueConverter が再度呼び出されませんか? 例:
<MenuItem Header="{Binding Path=DataContext.Documents, RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type ListView}}, Converter={StaticResource DocumentsToString}, Mode=OneWay}">
<MenuItem.Icon>
<Image Source="Images/upload.png" Style="{StaticResource ImageContextMenu}"/>
</MenuItem.Icon>
</MenuItem>
および ValueConverters.cs
public class ListDocumentToStringConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var selectedDocuments = (ObservableCollection<Document>) value;
var result = "";
foreach (var document in selectedDocuments)
{
result += document.Name + "\t";
}
return result;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}