combo box bind to IEnumerable
public class XXXType : IEnumerable
{
public string SetType = "Set XXXX";
public string NoXXX = "No XXXX;
public string Year= "Year";
public string Month= "Month";
public string Day= "Day";
public IEnumerator GetEnumerator()
{
yield return SetType ;
yield return NoXXX ;
yield return Year;
yield return Month;
yield return Day;
}
}
public XXXType XXXTypeData= new XXXType();
<ComboBox
ItemsSource="{Binding Path=XXXTypeData}
SelectedItem="{Binding Path=SelectedXXXTypeData.Value, Mode=TwoWay}"
/>
或者用 <ObjectProvider >