0
ItemsSource = list를 통해 목록으로 채울 목록 상자가 있습니다.프로그래밍 방식으로 ListBoxItem에 IsChecked 속성을 설정하는 방법?
이제 다른 목록이 있습니다. ListBoxItem.Name이 같은지 확인하기 위해 ListBox를 반복합니다. 그렇다면 ListBoxItem을 선택해야합니다.
내 생각 :
List<string> firstList = new List<string>();
List<string> secondList = new List<string>();
Listboxx.ItemsSource = firstList;
foreach (string striing in secondList)
{
foreach (ListBoxItem iitem in Listboxx)
{
if (striing == iitem.Name)
{
iitem.IsSelected = true;
}
}
}
또는 {IsCheckedOrNot 바인딩}로의 IsChecked의 부울을 설정하는 ListboxItemTemplate있는 방법이?