我正在开发适用于 Windows 8 的 C# Metro 风格应用程序,但在源数据更改时更新我的数据绑定组合框时遇到问题。
这是数据源:
public class Range
{
public string range_name { get; set; }
public string range_description { get; set; }
public int min { get; set; }
public int max { get; set; }
}
static List<Range> ranges = new List<Range>
{
new Range { range_name = "Foo", range_description = "Foo: (0-10)", min = 0, max = 10},
new Range { range_name = "Bar", range_description = "Bar: (5-15)", min = 5, max = 15},
new Range { range_name = "Baz", range_description = "Baz: (10-20)", min = 10, max = 20},
new Range { range_name = "Custom", range_description = "Custom: (0-20)", min = 0, max = 20}
};
和组合框:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<ComboBox Name="combo_range" ItemsSource="{Binding Path=Range}" DisplayMemberPath="range_description" SelectedValuePath="range_name" SelectedValue="{Binding Path=Range}" SelectionChanged="combo_range_SelectionChanged"/>
</Grid>
用户可以在应用程序中操纵“自定义”范围的最小/最大范围范围,但组合框仅在我从该记录更改然后更改回“自定义”时才会更新。
当源数据发生变化时,我需要做什么来强制组合框实时更新?
谢谢