I'm developing an application that has a grouped list, and within each list item there is a checkbox. The problem that is occurring happens when the checkbox of the first item in group 1 is selected, the checkbox of the first item in group 2 is also selected. But this only occurs visually, in no time the check event is called for the 2 checkbox. I would like to know if anyone has already gone through this, and if yes how to do it, thank you.
EDIT: ----
In my xml I have the LongListSelector:
<phone:LongListSelector
x:Name="llsAlunosTurmas"
Background="Transparent"
ItemTemplate="{StaticResource AddrBookItemTemplate}"
LayoutMode="List" />
and the date template of the items:
<DataTemplate x:Key="AddrBookItemTemplate" x:Name="dte" >
<StackPanel VerticalAlignment="Top"
Margin="0,3,0,0"
Background="White"
HorizontalAlignment="Stretch"
Orientation="Horizontal">
<StackPanel Orientation="Vertical"
Margin="12,0,0,0"
VerticalAlignment="Center">
<TextBlock Foreground="{StaticResource CorTxtPagina}"
VerticalAlignment="Center"
Text="{Binding matricula}"
Width="385"
FontSize="16"
TextTrimming="WordEllipsis"
FontStretch="SemiCondensed"/>
<TextBlock Foreground="{StaticResource CorTxtPagina}"
Text="{Binding nomAlu}"
Width="385"
FontSize="16"
HorizontalAlignment="Left"
TextTrimming="WordEllipsis" />
</StackPanel>
<CheckBox x:Name="cbxAlunos"
Background="{StaticResource CorBotoes}"
Click="cbxAlunos_Click"
IsChecked="{Binding selecionado, Mode=OneWay}"
Tag="{Binding idtAlu}"/>
</StackPanel>
</DataTemplate>
and in C #, after receiving the data by webservice, I organize how the data will be displayed (the grouping) and put it as dataset of the list:
if (lista.Count != 0)
{
int cont = 0;
string turmaAtual = lista.First().idtTurma;
foreach (var item in lista)
{
if (turmaAtual != item.idtTurma)
{
cont++;
turmaAtual = item.idtTurma;
}
item.ordem = cont + "";
}
List<string> headers = lista.GroupBy(aluno => aluno.idtTurma).Select(grp => grp.First().turma).ToList();
lista = lista.OrderBy(aluno => aluno.nomAlu).ToList();
alunos = lista;
llsAlunosTurmas.ItemsSource = AlphaKeyGroup<Aluno>.CreateGroups(lista, headers,
System.Threading.Thread.CurrentThread.CurrentUICulture,
(Aluno a) => { return a.ordem; }, false);
}