Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF DataGrid cell click

WPF DataGrid cell click

Scheduled Pinned Locked Moved WPF
wpfquestionhelpcsharpdatabase
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LAPEC
    wrote on last edited by
    #1

    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>

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups