How to edit WPF Datagrid cell

Chanmingman's Blog

This article will show you the way to change the cell in WPF Datagrid.

I have been reading people asking how to change the cell in WPF Datagrid. A lot of article with a lot of theory somehow the code won’t work.

I give you only 2 pieces of code here.

The first one, MainWindow.xaml. Replace your xaml code with the code below.

<Window x:Class=”WpfAppDataGrid.MainWindow”

        xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”

        xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”

        Title=”MainWindow” Height=”350″ Width=”525″>

    <Grid>

        <DataGrid Name=”dataGrid1″ HorizontalAlignment=”Left” Height=”160″ Margin=”26,23,0,0″ VerticalAlignment=”Top” Width=”419″ AutoGenerateColumns=”True” />

        <Button Content=”Refresh” HorizontalAlignment=”Left” Margin=”26,211,0,0″ VerticalAlignment=”Top” Width=”75″ Click=”Button_Click”/>

        <Button Content=”Modify” HorizontalAlignment=”Left” Margin=”123,211,0,0″ VerticalAlignment=”Top” Width=”75″ Click=”Button_Click_1″/>

        <Label Name=”label1″ Content=”Label” HorizontalAlignment=”Left” Margin=”26,255,0,0″ VerticalAlignment=”Top” Width

View original post 447 more words

Blog at WordPress.com.

Up ↑