How to edit selected row of DataGrid and add the new row to DataGrid
MainWindow.xaml <Window x:Class="WpfEx.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfEx" mc:Ignorable="d"> <StackPanel> <DataGrid ItemsSource="{Binding LstStudents}" SelectedItem="{Binding SelectedStudent}" AutoGenerateColumns="False" Height="200" Width="200" HorizontalAlignment="Left"> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Name}"/> <DataGridTextColumn Header="Roll" Binding="{Binding Roll}"/>