Here the code // XAML of MyWindow.xaml //1//<Window> //2//<Menu> //3//<MenuItem Command="{x:Static custom:MyWindow.SomeRoutedCommand}"> //4//</Menu> //5//<Window.CommandBindings> //6//<CommandBinding Command="{x:Static custom:MyWindow.SomeRoutedCommand}" Executed="SomeCommandExecutedHandler" /> //7//</Window.CommandBindings>
//CS of MyWindow.xaml.cs public partial class MyWindow { public static RoutedCommand SomeRoutedCommand= new RoutedCommand(); private void SomeCommandExecutedHandler(Object sender, ExecutedRoutedEventArgs e) {}
All this stuff returns following errors: Error 1 Unknown build error, 'Key cannot be null. Parameter name: key Line 3 Position 96.' Error 2 Could not create an instance of type 'StaticExtension'. in line 6
What's wrong? I just want to add my custom routedevent to menuitem without input gestures
Thank you
Tamir Khason
I think you did not add namespace mapping in the XAML window
xmlns:custom
="clr-namespace:..."
lee d
I do, but I found other more critical problem. Maybe it's connected. While begun to get thouse errors my editor does not working, but in runtime everything is ok... This happened after addition of other Window to the project