J'ai un listBox avec la case à cocher, quand un événement se termine, je dois décocher chaque case à cocher.Effacer les valeurs d'une CheckBoxList?
Ceci est mon xaml, mais dans le code comment puis-je effacer ces valeurs? Merci
<ListBox Name="_employeeListBox" ItemsSource="{Binding employeeList}" Margin="409,27,41,301">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Name="CheckBoxZone" Content="{Binding OperatorNum}" Tag="{Binding TheValue}" Checked="CheckBoxZone_Checked"/>
<TextBlock Grid.Column="1"></TextBlock>
<TextBlock Grid.Column="2" Text="{Binding Name}"></TextBlock>
<TextBlock Grid.Column="3"></TextBlock>
<TextBlock Grid.Column="4" Text="{Binding LastName}"></TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
private void _searchProjectsbyEmployeebutton_Click_1(object sender, RoutedEventArgs e)
{
List<EmployeebyProject> employeebyProjectList = new List<EmployeebyProject>();
if (EmployeeCollectionToInsert.Count != 0)
{
foreach (var employee in EmployeeCollectionToInsert)
{
foreach(var employeebyProject in employee.EmployeebyProject)
{
employeebyProjectList.Add(employeebyProject);
}
}
LoadEmployeebyProject(employeebyProjectList);
//HERE I NEED UNCHECKED the ListBoxChecked.
}
else { MessageBox.Show("Please select an employee to search his project."); }
}
Je suggère que votre applicaiton a besoin de plus de séparation entre la vue et le ViewModel. – EtherDragon