하나의 listBox에 확인란이 있습니다. 이벤트가 끝나면 각 확인란의 선택을 취소해야합니다.CheckBoxList의 값을 지우시겠습니까?
이것은 내 xaml이지만 코드에서 어떻게이 값을 지울 수 있습니까? 덕분에
<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."); }
}
나는 당신의 applicaiton은보기와 뷰 모델 사이의 더 분리를 필요로하는 제안을 구현해야합니다. – EtherDragon