Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.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
Windows store apps 为什么我被告知一个类在我的命名空间中不存在,而它却存在?_Windows Store Apps_Custom Controls_Winrt Xaml_Xml Namespaces_Resourcedictionary - Fatal编程技术网

Windows store apps 为什么我被告知一个类在我的命名空间中不存在,而它却存在?

Windows store apps 为什么我被告知一个类在我的命名空间中不存在,而它却存在?,windows-store-apps,custom-controls,winrt-xaml,xml-namespaces,resourcedictionary,Windows Store Apps,Custom Controls,Winrt Xaml,Xml Namespaces,Resourcedictionary,我正在尝试向我的项目中添加一个自定义控件,这样我就可以将其命名为(“promptForPhotosetName”),如下所示: 我基于模板控件向项目中添加了一个自定义控件 我的自定义控件类(位于Photrax命名空间中)包含以下构造函数: public promptForPhotosetName() { this.DefaultStyleKey = typeof(promptForPhotosetName); } 我在\Themes\Generic.xaml中有这个文件,它是在添加自定

我正在尝试向我的项目中添加一个自定义控件,这样我就可以将其命名为(“promptForPhotosetName”),如下所示:

我基于模板控件向项目中添加了一个自定义控件

我的自定义控件类(位于Photrax命名空间中)包含以下构造函数:

public promptForPhotosetName()
{
    this.DefaultStyleKey = typeof(promptForPhotosetName);
}
我在\Themes\Generic.xaml中有这个文件,它是在添加自定义控件时创建的另一个文件(连同promptForPhotsetName.cs):

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Photrax">

    <Style TargetType="local:promptForPhotosetName">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:promptForPhotosetName">
                    <StackPanel Orientation="Vertical">
                        <ListBox >
                            <ListBoxItem>
                                <StackPanel  Orientation="Horizontal">
                                    <Image Source="Windows 8.jpg" Height="200" Width="300" Stretch="Fill"></Image>
                                    <Image Source="Windows_8.jpg" Height="200" Width="300"   Stretch="Fill"></Image>
                                    <Image Source="windows8(1).jpg" Height="200" Width="300"   Stretch="Fill">
                                    </Image>
                                </StackPanel>
                            </ListBoxItem>
                        </ListBox>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

但是我得到了这个错误:名称“promptForPhotosetName”在名称空间“using:Photrax”中不存在,在这两行XAML上:

<Style TargetType="local:promptForPhotosetName">

…还有这个:

<ControlTemplate TargetType="local:promptForPhotosetName">


为什么?promptForPhotosetName类确实在Photrax名称空间中!

听起来像是设计工具错误。重建项目应该让设计师认识到它以前没有见过的类型。

什么是Hec拉姆齐!?没有对代码做任何更改,我在发布后返回并编译了,它编译得很好ler沙鼠午睡,或者更糟糕的是,更早地摄入改变思维的物质,或者什么?也许你第一次点击“编译”不够努力?我写得太快了-现在错误消息又回来了…但现在只在第二个位置!!!(控制模板行)…??如果我删除第二个atogether(“TargetType”位),它编译得很好…所以这是一个已知的问题?沙鼠应该得到通知,它们可以被替换。
<ControlTemplate TargetType="local:promptForPhotosetName">