WPF 不支持应用程序命令

Application Commands is not supported in WPF

使用 WPF(初学者):-)

我一直收到错误 "ApplicationCommans is not supported in a Windows Presentation Foundation (WPF) project"

我刚刚开始我的项目..

解决方案平台:AnyCPU

<Window x:Class="Wpf_CreatingARichTextEditor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Wpf_CreatingARichTextEditor"
        mc:Ignorable="d"
        Title="MainWindow" Height="300" Width="400">

  <Window.CommandBindings> 

    <CommandBinding Command="ApplicationCommans.Open"
                    Executed="CommandBinding_Executed" />

  </Window.CommandBindings>

    <Grid>

    </Grid>
</Window>

谢谢

它不是 ApplicationCommans..它是 ApplicationCommands.Open。只需更改应该可以解决问题的命令的名称。

希望对您有所帮助。

对我来说,我在从 MSDN 复制并粘贴到 XAML 时遇到了这个问题。我必须删除的应用程序和命令之间有一个不可见的零宽度连接符(大概是为了帮助自动换行)