名称metrowindow不存在?

时间:2016-10-14 04:46:18

标签: c# wpf

我遇到错误命名空间中名称metroWindow不存在:MahApps.Metro.Controls; assembly = MahApps.Metro"我不知道问题出在哪里我也检查了由NuGet取代的mahapps,但仍然是同样的问题,我目前正在使用VS2012。我已经检查过几个堆栈问题,但问题仍然存在。



<controls:MetroWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
       
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="DTWGestureRecognition.MainWindow"
        
        Title="Kinect Sign Language Translator" Height="900" Width="1500" Loaded="WindowLoaded" Closed="WindowClosed" Background="White">
    <Viewbox Height="768" VerticalAlignment="Top" Width="1366">
        <Border>
            <Grid Height="186" Width="2000">
                <TabControl x:Name="tabControl" Margin="-59,0,461,0">


                    <TabItem Header="Intro">
                        <Grid Margin="0,0,-527,-1053">
                            <Grid.Background>
                                <ImageBrush ImageSource="elisabet2.png"/>
                            </Grid.Background>
                        </Grid>
                    </TabItem>
                    <TabItem Header="Gesture Detection">



                        <Grid Margin="0,0,-527,-1053" Background="White">
                            <Canvas x:Name="skeletonCanvas" Background="Black" ClipToBounds="True" Margin="293,256,1186,456" Height="480"  Width="640" />
                            <Image x:Name="videoImage" Margin="953,256,526,456" Width="640" Height="480" />
                            <Image x:Name="depthImage" Grid.Column="1" HorizontalAlignment="Left" Height="12" Margin="1416,730,0,0" Grid.Row="1" VerticalAlignment="Top" Width="40" IsEnabled="False"/>






                            <StackPanel Margin="1615,257,18,691">
                                <ComboBox x:Name="gestureList" Width="486" HorizontalAlignment="Center" Height="50" Background="#FF455A64" FontSize="24" FontFamily="Arial" Foreground="White">
                                    <ComboBoxItem IsSelected="True" Content="@from"/>
                                    <ComboBoxItem Content="@go there"/>
                                    <ComboBoxItem Content="@good"/>
                                    <ComboBoxItem Content="@happy"/>
                                    <ComboBoxItem Content="@Hello."/>
                                    <ComboBoxItem Content="@in"/>
                                    <ComboBoxItem Content="@me"/>
                                    <ComboBoxItem Content="@out"/>
                                    <ComboBoxItem Content="@Please"/>
                                    <ComboBoxItem Content="@school"/>
                                    <ComboBoxItem Content="@Thank you"/>
                                    <ComboBoxItem Content="@today"/>
                                    <ComboBoxItem Content="@understand"/>
                                    <ComboBoxItem Content="@what"/>
                                    <ComboBoxItem Content="@where"/>
                                    <ComboBoxItem Content="@wrong"/>
                                    <ComboBoxItem Content="@yes"/>
                                    <ComboBoxItem Content="@you"/>
                                    <ComboBoxItem Content="@your"/>
                                </ComboBox>
                                <TextBox FontSize="24" x:Name="results" Focusable="False" BorderThickness="0" Text="" TextAlignment="Left" VerticalAlignment="Top" Height="65" Foreground="White" Background="#FF455A64" FontFamily="Arial"  />
                                <TextBox FontSize="24" x:Name="status" Focusable="False" BorderThickness="0" Text="" TextAlignment="Left" VerticalAlignment="Top" Height="65" Foreground="White" Background="#FF455A64" FontFamily="Arial" />
                                <TextBox FontSize="24" x:Name="currentBufferFrame" Focusable="False" BorderThickness="0" Text="" TextAlignment="Left" VerticalAlignment="Top" Height="65" Foreground="White" Background="#FF455A64" FontFamily="Arial" />
                            </StackPanel>


                            <StackPanel Margin="0,259,1838,452">
                                <Button x:Name="dtwRead" Content="Read" Click="DtwReadClick" Width="200" IsEnabled="False" Background="#FF455A64" Foreground="White" Height="65" FontSize="18.667"/>
                                <Button x:Name="dtwCapture" Content="Capture" Click="DtwCaptureClick" Width="200 " Background="#FF455A64" Height="65" FontSize="18.667" Foreground="White"/>
                                <!-- <Button x:Name="dtwShowGestureTest" Content="Show Gesture Text" IsEnabled="True" Click="DtwShowGestureText" Width="200"  /> -->
                                <Button x:Name="dtwStore" Content="Store" IsEnabled="False" Click="DtwStoreClick" Width="200" Background="#FF455A64" Height="65" FontSize="18.667" Foreground="White" />
                                <Button x:Name="dtwLoadFile" Content="Load gesture file" IsEnabled="True" Click="DtwLoadFile" Width="200" Margin="40,0,41,0" Height="65" Background="#FF455A64" Foreground="White" FontSize="18.667" />
                                <Button x:Name="dtwSaveToFile" Content="Save to file" IsEnabled="True" Click="DtwSaveToFile" Width="200" Margin="40,0,41,0" Height="65" Background="#FF455A64" Foreground="White" FontSize="18.667" />
                            </StackPanel>


                            <TextBox FontSize="18.667" x:Name="dtwTextOutput" Margin="1615,646,17,0" Focusable="True" BorderThickness="0" Text="" TextAlignment="Left" HorizontalAlignment="Center" VerticalAlignment="Top" Width="487" Height="414" VerticalScrollBarVisibility="Auto" IsReadOnly="True" IsEnabled="False" BorderBrush="Black" Background="White" Foreground="White" />


                            <TextBox x:Name="textBox2" Margin="293,915,526,132" TextWrapping="WrapWithOverflow" FontSize="32" Background="Black" OpacityMask="{x:Null}" VerticalContentAlignment="Center" BorderBrush="#FF7C2020" IsReadOnly="True" Foreground="White" />



                            <Label x:Name="label1_Copy" Content="COORDINATES" HorizontalAlignment="Left" Margin="1615,603,0,0" VerticalAlignment="Top" Width="486" FontSize="21.333" FontStyle="Italic" HorizontalContentAlignment="Center"/>

                            <Label x:Name="label_Copy1" Content="GESTURE SELECTOR" HorizontalAlignment="Left" Margin="1615,208,0,0" VerticalAlignment="Top" Width="486" FontSize="21.333" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontStyle="Italic"/>


                            <Label x:Name="label2" Content="SIGNS TRANSLATOR" HorizontalAlignment="Left" Margin="817,50,0,0" Width="494" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="26.667" FontStyle="Italic"/>

                            <Label x:Name="label" Content="SKELETON VIEW" HorizontalAlignment="Left" Margin="293,218,0,0" VerticalAlignment="Top" Width="640" FontSize="21.333" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontStyle="Italic" RenderTransformOrigin="0.702,0.503"/>
                            <Label x:Name="label_Copy" Content="COLOR VIEW" HorizontalAlignment="Left" Margin="953,218,0,0" VerticalAlignment="Top" Width="640" FontSize="21.333" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontStyle="Italic"/>
                            <Label x:Name="label1" Content="OUTPUT" HorizontalAlignment="Left" Margin="423,872,0,0" VerticalAlignment="Top" Width="1082" FontSize="21.333" FontStyle="Italic" HorizontalContentAlignment="Center"/>





                        </Grid>


                    </TabItem>
                    <TabItem Header="Text Detection">
                        <TabItem.Background>
                            <ImageBrush/>
                        </TabItem.Background>

                        <Grid Margin="0,0,-527,-1053">
                            <Grid.Background>
                                <ImageBrush ImageSource="website-under-construction.png" Stretch="Uniform"/>
                            </Grid.Background>
                        </Grid>


                    </TabItem>
                    <TabItem Header="Tutorial">
                        <TabItem.Background>
                            <ImageBrush/>
                        </TabItem.Background>
                        <Grid Margin="0,0,-527,-1053">
                            <Grid.Background>
                                <ImageBrush ImageSource="website-under-construction.png" Stretch="Uniform"/>
                            </Grid.Background>
                        </Grid>
                    </TabItem>
                    <TabItem Header="About Us">
                        <TabItem.Background>
                            <ImageBrush/>
                        </TabItem.Background>
                        <Grid Margin="0,0,-527,-1053">
                            <Grid.Background>
                                <ImageBrush ImageSource="website-under-construction.png" Stretch="Uniform"/>
                            </Grid.Background>
                        </Grid>
                    </TabItem>
                </TabControl>

            </Grid>

        </Border>
    </Viewbox>



</controls:MetroWindow>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:4)

就我而言,随着MahApps nuget的基本安装,它得以实现。所以,代码不是问题。尝试卸载MapApps nuget,然后重新安装或在程序包管理器控制台中运行以下命令:

Install-Package MahApps.Metro -Version 1.3.0

请记住,不是您的代码,而是您的配置。如果更新无法解决问题,请尝试删除任何可能导致问题的样式。它也可能是一种风格问题。

答案 1 :(得分:0)

我知道已经晚了,

但是对我来说,只有xmlns的更改有所帮助。

xmlns产生与所述相同的错误

xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"

对我有用的xmlns(与您使用的相同):

xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
相关问题