используйте Binding Converter:
public class CommandParamConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string)
{
return string.Format("Key {0}", value);
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Добавьте его в ресурс Windows \ UserControl:
<Window.Resources>
<local:CommandParamConverter x:Key="commandParamConverter" />
</Window.Resources>
См. Это в привязке меню CommandParameter:
<MenuItem Header="Key" CommandParameter="{Binding Converter={StaticResource commandParamConverter}, Path=PlacementTarget.Tag, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>