相关疑难解决方法(0)

Windows Presentation Foundation (WPF) 项目不支持 AppCommand

我试图在 VS2012 (Window 7) 中运行问题“ Understanding ICommandimplementation without MVVM ”中的代码,但出现错误:“WindowsPresentationFoundation(WPF)项目中不支持AppCommand”

在此输入图像描述

好吧,出了什么问题或者我应该做什么才能运行该问题的代码?

MainWindow.xaml.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace seWPFUnderstandingICommandWithout_MVVM
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            AppCommands.AnyCommand.CanExecuteChanged += MyEventHandler;
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            // Nothing for the moment
        }
        private void MyEventHandler(object sender, EventArgs e)
        {
            Console.WriteLine("MyEventHandler called");
        }
     } …
Run Code Online (Sandbox Code Playgroud)

c# wpf mvvm command-pattern icommand

0
推荐指数
1
解决办法
2871
查看次数

标签 统计

c# ×1

command-pattern ×1

icommand ×1

mvvm ×1

wpf ×1