0

我在我的代码中收到以下错误,我在属性选项卡中更改了 2 个按钮的名称。

Error   1   The type 'x100.MainWindow' already contains a definition for 'startBtn
Error   2   The type 'x100.MainWindow' already contains a definition for 'listBtn'

这是我的 XAML 文件

<Window x:Class="x100.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="696" Width="538">
<Grid>
    <Button x:Name="startBtn" Content="Start" HorizontalAlignment="Left" Height="55" Margin="10,601,0,0" VerticalAlignment="Top" Width="101" Click="startBtn"/>
    <Button x:Name="listBtn" Content="List (.exe)" HorizontalAlignment="Left" Height="55" Margin="126,601,0,0" VerticalAlignment="Top" Width="105"/>
    <TextBox x:Name="txtBoxShow" HorizontalAlignment="Left" Height="596" Margin="10,0,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="510"/>
    <Button Content="List (.jpg)" HorizontalAlignment="Left" Height="55" Margin="247,601,0,0" VerticalAlignment="Top" Width="105"/>

</Grid>               
</Window>

任何帮助表示赞赏,谢谢!

4

1 回答 1

2

这意味着您已经声明了 2 个具有相同名称的控件,一个在标记中,一个在后面的代码中。从后面的代码中删除声明。

于 2013-06-19T17:55:38.540 回答