Getting selected Item in DataGrid in WPF

前端 未结 2 1424
再見小時候
再見小時候 2021-01-27 02:30

I have a datagrid and textboxes. When I select a row in DataGrid I want the textboxes to be filled with related data of that datagrid column. Here is the picture.,

2条回答
  •  孤城傲影
    2021-01-27 03:12

    Here's how you could do it with bindings. The "Text" parameter of each textbox should be modified thusly:

    Text = "{Binding ElementName = personelEntityDataGrid, Path = CurrentItem.}"
    

    so for the nameBox, you would have:

    Text = "{Binding ElementName = personelEntityDataGrid, Path = CurrentItem.Name}"
    

提交回复
热议问题