I have a listbox .list box bind with dataset.listbox binding is giving correct result I used checkbox in the list box for selection and that is working fine, but the problem is that when I am checked some item list box and scroll down the list box and checked another item go back above scrolldown then see some item randomly automatically unchecked. I don't want the item automatically unchecked. Please help me. I using this code below.
<DataTemplate x:Key="listBoxcontrycode">
<StackPanel Margin="4">
<DockPanel>
<CheckBox Name="chkcntrycode" Content="{Binding userisd}"
Checked="chkcntrycode_Checked" Unchecked="Unchkcntrycode_Checked" />
</DockPanel>
</StackPanel>
<ListBox Height="89" HorizontalAlignment="Left" ItemTemplate="{StaticResource listBoxcontrycode}" ItemsSource="{Binding Tables[0]}" Margin="160,0,0,6"
Name="listcntrycode" VerticalAlignment="Bottom" Width="86" Grid.Column="3" Grid.ColumnSpan="2" Grid.RowSpan="2"
OverridesDefaultStyle="False" SelectionMode="Extended" IsEnabled="True" Grid.Row="3" />
.
private void ListBoxBindingcntrycode()
{
DBConnection ob = new DBConnection();
RMS_Dataobject.getConnectionString = System.Configuration.ConfigurationSettings.AppSettings["EDM_RDMServer"];
string commandString = "use [" + cmbEDM.SelectedItem.ToString() + "] select userisd from ADS_Audit_Log";
DataTable dt = new DataTable();
dt = ob.ReturnDatatable(commandString);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
listcntrycode.DataContext = ds;
}