Click here to Skip to main content
15,902,445 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i ma new in wpf
i want search control in wpf window base i goes some problem
following my code i am right is run true way but cant be check datagrid inside check box check


XML
<DataGrid x:Name="grdshow"   TabIndex="4"  AutoGenerateColumns="False"  ItemsSource="{Binding}"  FontSize="11" HorizontalAlignment="Left"  Margin="10,41,0,0" VerticalAlignment="Top" Width="670" Height="455" IsTabStop="True" RenderTransformOrigin="0.5,0.5" FontFamily="Verdana">
            <DataGrid.Columns>
                <DataGridCheckBoxColumn Header="YES/NO" Width="60" x:Name="chkyesno" Binding="{Binding ACLOCK,Mode=TwoWay}"    />
                <DataGridTextColumn Header="NAME" Width="210"  Binding="{Binding ANAME}"></DataGridTextColumn>
                <DataGridTextColumn Header="ADDRESS" Width="160" Binding="{Binding AADD1}"></DataGridTextColumn>
                <DataGridTextColumn Header="GROUP" Width="130" Binding="{Binding AAGROUP}"></DataGridTextColumn>
                <DataGridTextColumn Header="CODE" Width="100" Binding="{Binding ACODE}"></DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>




vb.net
SQL
OCcmd = New SqlCommand("SELECT ACLOCK,ANAME,AADD1,AAGROUP,ACODE from macntmst where aagroup='" & Txtacheadname.Text & "' ", sqlcn)
      OCadp.SelectCommand = OCcmd
      OCadp.Fill(ds_ldrLU)
      dv2 = New DataView(ds_ldrLU)


VB
grdshow.ItemsSource = dv2
     grdshow.AutoGenerateColumns = False
     OCcmd.Dispose()
     Dim rowidx As Integer = grdshow.Items.IndexOf(grdshow.CurrentCell.Item)
     MessageBox.Show("show")

     For Each dr As DataRow In ds_ldrLU.Rows
         Dim vl As String = dr.Item(0)
         If vl = "Y" Then

             TryCast(grdshow.Columns(0).GetCellContent(grdshow.Items(0)), System.Windows.Controls.CheckBox).IsChecked = True

         Else
             DirectCast(grdshow.Columns(0).GetCellContent(grdshow.Items(0)), System.Windows.Controls.CheckBox).IsChecked = False

         End If


     Next
Posted
Updated 9-Dec-13 2:10am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900