WPF DataGrid: Make cells readonly

Total Post:104

Points:728
WPF 
WPF
 2229  View(s)
Ratings:
Rate this:

I use the following DataGrid

<DataGrid Grid.Row="1" Grid.Column="1" Name="Grid"
ItemsSource="{Binding}" AutoGenerateColumns="False" >
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name" Width="100" Binding="{Binding Path=Name}"></DataGridTextColumn>
                <DataGridTextColumn Header="OldValue" Width="100" Binding="{Binding Path=OldValue}"></DataGridTextColumn>
                <DataGridTextColumn Header="NewValue" Width="100*" Binding="{Binding Path=NewValue}"></DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>

How can I make the cells readonly?

  1. Post:378

    Points:2694
    Re: WPF DataGrid: Make cells readonly

    Hi Marcel,


    Set DataGrid's IsReadOnly property to true.

    <DataGrid Grid.Row="1" Grid.Column="1" Name="Grid" ItemsSource="{Binding}"

     IsReadOnly="True" AutoGenerateColumns="False" >

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!