HOW CAN I MAKE THE WPF DATAGRID CELLS READONLY?

Goti Bandu

Total Post:119

Points:835
Posted by  Goti Bandu
WPF 
WPF
 5759  View(s)
Ratings:
Rate this:

<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 cells readonly 

Any help will be appreciated. 

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: How can I make the wpf datagrid cells readonly?

    Hi Goti,


    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!