名称metrowindow不存在
本文关键字:不存在 metrowindow 名称 | 更新日期: 2023-09-27 18:13:11
我遇到一个错误,名称metroWindow在命名空间中不存在:MahApps. metro . controls;assembly=MahApps。"我不知道问题在哪里,我也检查了NuGet取代的可能,但我目前使用的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>
在我这边,使用MahApps nuget的基本安装就可以了。所以,代码不是问题所在。尝试卸载MapApps nuget,然后重新安装,或者在Package Manager Console中运行以下命令:
Install-Package MahApps.Metro -Version 1.3.0
记住,不是你的代码,而是你的配置。如果更新不能解决问题,请尝试删除任何可能导致问题的样式。也有可能是样式问题
我知道已经很晚了,
但对我来说,只有改变xmlns
才有帮助。
xmlns产生与描述相同的错误:
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
适用于我的xmlns(与您使用的相同):
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"