How to detect if a Checkbox is switched on and off and write those changes back to the datasource?
<pre><code> &lt;DataGrid Name="employeesDataGrid" AutoGenerateColumns="False"&gt;
        &lt;DataGrid.Columns&gt;
            &lt;DataGridCheckBoxColumn
                xmlns:myconv="clr-namespace:MyProject.Converters"
                Binding="{Binding enabled, Converter={myconv:IntToBool}}"
                Header="Enabled"&gt;
                &lt;DataGridCheckBoxColumn.CellStyle&gt;
                    &lt;Style&gt;
                        &lt;EventSetter Event="CheckBox.Checked" Handler="OnChecked" /&gt;
                    &lt;/Style&gt;
                &lt;/DataGridCheckBoxColumn.CellStyle&gt;
            &lt;/DataGridCheckBoxColumn&gt;
            &lt;DataGridTextColumn 
                Binding="{Binding proxyFor}"
                Header="Proxy For"
                /&gt;
        &lt;/DataGrid.Columns&gt;
    &lt;/DataGrid&gt;
</code></pre>

<p>Code Behind</p>

<pre><code>    private void OnChecked(Object sender, RoutedEventArgs e)
    {
        // Not sure what to do here.
    }
</code></pre>

<p>How do I keep track of whats changed in the DataTable or the selected row?</p>

<p>I am loaded this at Initialize() with the following code</p>

<pre><code>        using (OleDbConnection con = new OleDbConnection(connectionString))
        {
            dt = new DataTable("accesscontrol");

            CmdString = "SELECT proxyFor, enabled FROM accesscontrol WHERE currentlyLoggedOnUser = @userName";
            OleDbCommand cmd = new OleDbCommand(CmdString, con);
            cmd.Parameters.AddWithValue("userName", Environment.UserName);
            using (adapter = new OleDbDataAdapter(cmd))
            {
                adapter.Fill(dt);
            }                    
            employeesDataGrid.ItemsSource = dt.DefaultView;
</code></pre>