WPF DATAGRID: MAKE CELLS READONLY

marcel ethan

Total Post:105

Points:735
Posted by  marcel ethan
WPF 
WPF
 1764  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. Sumit Kesarwani

    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!