내가하려고하는 모든 작업은 목록 상자의 각 값에 대해 선택한 값과 그 값을 비교하는 것입니다 .!'System.String'형식의 개체를 "..Controls.SurfaceListBoxItem '예외로 캐스팅 할 수 없습니다.
foreach(SurfaceListBoxItem n in BackgroundsList.Items)
{
if (n.ToString() == current) BackgroundsList.SelectedItem = n;
}
감사 WPF에서