任何人都知道,为什么我会收到此错误:"关闭元素标签' StackPanel'找不到"
对于此代码:
<Window x:Class="BiztositasFeladat.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded_1">
<Grid>
<Button Content="New" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/>
<Button Content="Stat" HorizontalAlignment="Left" Margin="229,289,0,0" VerticalAlignment="Top" Width="75"/>
<ListBox x:Name="listBox" HorizontalAlignment="Left" Height="249" Margin="10,35,0,0" VerticalAlignment="Top" Width="497">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Content="{Binding Type}"/>
<Label Content="{Binding Name}"/>
<Label Content="{Binding Date}"/>
<Label Content="{Binding Amount}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Window>
答案 0 :(得分:1)
重新启动visual studio,然后重建。有时xaml编辑器卡住了,但我真的不知道为什么。无论如何,这种解决方法对我有用了几次