WPF DataGrid cell click
-
Hello Everyone I did asked a question to my problem couple of days ago on: How can I display all the details of the employee in the textboxes, comboboxes, and checkbox when I click on the cell of the DataGrid? Well somehow I managed to solve my problem with the help on searching on the internet, but I'm facing another problem. When I run my application I'm displaying only the names of the employee from the database on the DataGrid, then when I click on DataGrid cell (of the employee name, to display all the details of that employee into textboxes, comboboxes, and checkbox) some-how it repeats the details of the employee into textboxes. To be more clear to my problem: In my database table (EmployeeDetails table) I have 2 employee record details, These 2 employees (their names will be displayed on the DataGrid) When I click on the first employee name on the DataGrid cell to display his/her details When I click on the second employee name on the DataGrid cell to display his/her details etc. etc... Could someone please view the code I provided below and tell me what am I doing wrong... DataGrid xaml code:
<DataGrid Height="490" HorizontalAlignment="Left" Margin="6,8,0,0" Name="GridViewEmployeeName" VerticalAlignment="Top" Width="200" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Background="{x:Null}" FontFamily="Verdana" FontWeight="Bold" FontSize="16" GridLinesVisibility="None" BorderBrush="Silver" RowDetailsVisibilityMode="Visible" CanUserResizeRows="False" ItemsSource="{Binding}" SelectionChanged="GridViewEmployeeName_SelectionChanged" SelectionMode="Single" IsSynchronizedWithCurrentItem="{x:Null}" CanUserResizeColumns="False" AutoGenerateColumns="False" HeadersVisibility="Column" EnableRowVirtualization="False" CanUserAddRows="False" RowHeight="22">
<DataGrid.Columns>
<DataGridTextColumn FontSize="12" FontWeight="Bold" Header="Employee Name" IsReadOnly="True" Width="200" Binding="{Binding Name}" CanUserResize="False" FontFamily="Verdana" />
</DataGrid.Columns>