Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 名称为;“格式化命令”;命名空间中不存在“0”;clr命名空间:命令“U 1”;_C#_Wpf - Fatal编程技术网

C# 名称为;“格式化命令”;命名空间中不存在“0”;clr命名空间:命令“U 1”;

C# 名称为;“格式化命令”;命名空间中不存在“0”;clr命名空间:命令“U 1”;,c#,wpf,C#,Wpf,I xaml我收到了名称空间不存在的消息吗?我尝试了另一个新项目。但一切都没有改变 在中,我想实现下面类中的命令,这些命令位于同一程序集和同一项目中 <Window x:Class="Commands_1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/x

I xaml我收到了名称空间不存在的消息吗?我尝试了另一个新项目。但一切都没有改变

在中,我想实现下面类中的命令,这些命令位于同一程序集和同一项目中

<Window x:Class="Commands_1.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:Commands_1"
        mc:Ignorable="d"
        Title="Commands_1" Height="350" Width="525">

    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="Edit">
                <MenuItem Command="Copy"></MenuItem>
                <MenuItem Command="ApplicationCommands.Cut"></MenuItem>
                <MenuItem Command="{x:Static ApplicationCommands.Paste}"></MenuItem>
                <MenuItem Command="{x:Static local:FormatCommand.SetBackground}"/>
            </MenuItem>
        </Menu>
        <RichTextBox>
            <RichTextBox.CommandBindings>

            </RichTextBox.CommandBindings>
        </RichTextBox>
    </DockPanel>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Commands_1
{
    public static class FormatCommand
    {


      public static RoutedUICommand setBackground = new RoutedUICommand
            (
                "Set the Background",
                "SetBackground",
                typeof(FormatCommand));


        public static RoutedUICommand SetBackground { get { return SetBackground; } }

    }
}