0

I am receiving the following error in my code for 2 buttons that I changed the name of in the properties tab.

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

Here is my XAML file

<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>

Any help is appreciated, thanks!

venerik
  • 5,766
  • 2
  • 33
  • 43
ScorpioBlue
  • 189
  • 1
  • 5
  • 17

1 Answers1

2

it implies that you have declared 2 controls with the same name , one in the markup and the one in the code behind. Delete the declaration from code behind.

HappyLee
  • 435
  • 4
  • 11