tags:

views:

12

answers:

0

Hello Experts

i have A problem i m new in Wpf i m using Wpf Datagrid i hv one CheckBox Column (item template column) inside this. i m able to find its All Event but how can i get it i want ischeckdproperty true according to my condtion But i m Unable to caught it

my xaml code is below

 <my:DataGrid AlternatingRowBackground="LightBlue" AlternationCount="2" BorderBrush="SkyBlue" BorderThickness="2"  ColumnWidth="335" FontSize="14" Height="239" Name="dgPopupitem" RowBackground="LightYellow" RowHeight="25" Width="745" 
                       CanUserAddRows="False"   xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" >
                <my:DataGrid.Columns>

                    <my:DataGridTemplateColumn  Width="60" Header="Select">
                        <my:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Name="dgcheckbox" Checked="CheckBox_Checked" Margin="15,5,0,0" Unchecked="CheckBox_Unchecked" Content="{Binding}" />
                            </DataTemplate>
                        </my:DataGridTemplateColumn.CellTemplate>
                    </my:DataGridTemplateColumn>
                    <!--<my:DataGridCheckBoxColumn   Width="60" Header="Select"  Binding="{Binding IsSelected}" />-->


                </my:DataGrid.Columns>
            </my:DataGrid> 

And my C# Code IS

  public void check()
    {
        if (dtAllergies.Rows.Count > 0)
        {
            for (int i = 0; i <= dgPopupitem.Items.Count-1; i++)
            {
                for (int j = 0; j <= dtAllergies.Rows.Count - 1; j++)
                {
                    if (dtAllergies.Rows[j]["Allergy Name"].ToString()=="Water" )
                    {
                     //here i want this my Check Box                   
                    }
                }
            }
        }
    }

thanks in advance shashank