1
I am developing an application that has a grouped list, and within each item of the list there is a checkbox. The problem that has been occurring occurs 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, at no time the check event is called for the 2 checkbox. I wonder if anyone has ever been through it, and if yes how to resolve 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 via webservice, I organize how the data will be displayed (the grouping) and put 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);
}
Welcome to Stackoverflow Portuguese Kelvin. It would be interesting to post your code and show it where it can be the possible cause of the bug, this way it is better for the community to help you.
– gato
Hi Dener, thanks for replying, I already added the code as mentioned. Apr.
– kelvin sand