我有以下情形:其中包含了一年中的月份Silverlight的组合框和的SelectedItem
1清单:
public List<String> Months
{
get
{
return m_Months;
}
}
m_Months = new List<String>();
for (int i = 1; i <= 12; i++)
{
DateTime date = new DateTime(1900, i, 1);
m_Months.Add(date.ToString("MMM"));
}
1组合框,其ItemsSource绑定到数月的列表,其SelectedIndex的是绑定的财产一个月,这是一个字符串:
public string Month
{
get
{
return m_Month;
}
set
{
if (value != m_Month)
{
m_Month = value;
NotifyPropertyChanged("Month");
}
}
}
<ComboBox SelectedItem="{Binding Month, Mode=TwoWay}" ItemsSource="{Binding Months}" />
当我从代码隐藏,即月=“五一”设定年份,这是正确地传送到ComboBox,和GETT呃月访问,但组合框不会显示'五月',因为它是选定的项目。
我想知道:这是Silverlight 3中的错误吗?当我使用Telerik的RadComboBox时,它工作正常。
干杯, 弗朗西斯
希望他们有它在Silverlight 4中修复,但感谢张贴这个答案。 – Aligned 2010-04-26 18:12:15