मैंने कुछ दिन पहले WPF के साथ शुरुआत की है और मुझे कोई समस्या नहीं आई है जिसे मैं समझ नहीं पा रहा हूं।मान शून्य नहीं हो सकता है कमांडबाइंडिंग कस्टम कमांड
Value cannot be null. Parametername: value
त्रुटि यहां होती है::
<Window.CommandBindings>
<CommandBinding Command="self:CustomCommands.Exit" Executed="ExitCommand_Executed" CanExecute="ExitCommand_CanExecute"/>
</Window.CommandBindings>
मैं XAML में पाठ्यक्रम सेट नाम स्थान xmlns:self="clr-namespace:PrintMonitor"
की है
मैं निम्नलिखित त्रुटि मिली।
कोड-पीछे:
namespace PrintMonitor
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ExitCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
if(e != null)
e.CanExecute = true;
}
private void ExitCommand_Executed(object sender, ExecutedRoutedEventArgs e)
{
Application.Current.Shutdown();
}
}
public static class CustomCommands
{
public static readonly RoutedUICommand Exit = new RoutedUICommand
(
"Beenden",
"Exit",
typeof(CustomCommands),
new InputGestureCollection()
{
new KeyGesture(Key.F4, ModifierKeys.Alt)
}
);
}
}
तो क्यों अगर मैं जैसे का उपयोग नहीं यह त्रुटि आती मैं एक कस्टम आदेश का उपयोग करता है लेकिन Command="ApplicationCommands.New"
और मैं इस त्रुटि को कैसे ठीक कर सकता हूं?
कोड this tutorial का हिस्सा है।
वी.एस. के किन संस्करणों का उपयोग कर रहे हैं होने के लिए है? मैं ट्यूटोरियल और प्रदान किए गए स्निपेट के आधार पर आपकी त्रुटि को पुन: उत्पन्न करने में सक्षम नहीं हूं। – Geoffrey
बनाम 2015 एंटरप्राइज़ वी 14.0। मुझे यह जोड़ना चाहिए कि प्रोजेक्ट संकलित करता है और चलता है लेकिन त्रुटि –
बनी रहती है मैंने अब एक नई परियोजना बनाई है और 1: 1 की प्रतिलिपि बनाई है और त्रुटि चली गई है ... intellisense bug मुझे लगता है !? –