9
ComboBox
을 문자열, 값 쌍으로 채우려고합니다. 나는 다음과 같은 코드 숨김에서 그것을했다 :XAML에서 ComboBox를 채우는 방법
listCombos = new List<ComboBoxItem>();
item = new ComboBoxItem { Text = Cultures.Resources.Off, Value = "Off" };
listCombos.Add(item);
item = new ComboBoxItem { Text = Cultures.Resources.Low, Value = "Low" };
listCombos.Add(item);
item = new ComboBoxItem { Text = Cultures.Resources.Medium, Value = "Medium" };
listCombos.Add(item);
item = new ComboBoxItem { Text = Cultures.Resources.High, Value = "High" };
listCombos.Add(item);
combo.ItemsSource = listCombos;
ComboBoxItem : 당신이 볼 수 있듯이
public class ComboBoxItem
{
public string Text { get; set; }
public object Value { get; set; }
public override string ToString()
{
return Text;
}
}
, 내 ResourceDictionary
를 사용하여 Text
값을 삽입하고있다. 그러나 내가 이렇게하면 런타임에 언어를 변경할 때 ComboBox
내용이 변경되지 않습니다.
그래서 ComboBox
(XAML)을 작성하려고했습니다.
내 질문은 : 내 ComboBox
쌍으로 채울 수있는 방법 텍스트, 값 위와 비슷합니까?
정확히 해결책이었습니다! 감사! :) – Sonhja