title: DataGrid Edit and Readonly behaviour in wpf
body: <p>I m new to WPf Datagrid  .My requirement if i select a cell in datagrid and press enter it should changed to readonly= false(editable) and user can change the content and again if he press enter key the cell should  change to readonly = true(noneditable).</p>
  
  <p>My xaml look like this:</p>
  
  <pre><code>&lt;DataGrid AutoGenerateColumns="False" Height="496"  HorizontalAlignment="Left"  
            PreviewKeyDown="DgvMaterial_PreviewKeyDown" DataGridCell.Selected="DataGrid_select" 
            Name="DgvMaterial" VerticalAlignment="Top" Width="958" Margin="21,20,0,0"  
            ItemsSource="{Binding Path=., Mode=OneWay}"   
            AlternationCount="1" AlternatingRowBackground="#FFE9FFE9" 
            SelectionUnit="FullRow" CanUserResizeColumns="False" DataContext="{Binding}" 
            RowHeight="30" UseLayoutRounding="True" 
            RowHeaderWidth="0" OverridesDefaultStyle="False" ColumnHeaderHeight="30" 
            SelectionMode="Single" ScrollViewer.VerticalScrollBarVisibility="Auto" 
            FontFamily="MS Gothic" FontSize="12" CellStyle="{StaticResource Body_Content_DataGrid_Centering}" 
            IsHitTestVisible="True" SelectionChanged="DgvMaterial_SelectionChanged" 
            Loaded="DgvMaterial_Loaded" CellEditEnding="DgvMaterial_CellEditEnding" TabIndex="5"
            SelectedIndex="-1" IsReadOnly="True"&gt; 
  </code></pre>