当我在Windows Phone 8 SDK
.
枢轴绑定到一个名为的列表Students
并在单击它时设置一个按钮,将新建一个新的学生对象并将其设置Students[2]
为新值。这导致了下面屏幕截图中显示的重叠问题。有没有其他人遇到过这个问题WP8 SDK
?
这是代码
public MainPage()
{
InitializeComponent();
this.DataContext = this;
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
InitiList();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
int index = 2;
Students[index] = new Student();
Students[index].Name = "tian";
Students[index].College = "shida";
}
private ObservableCollection<Student> _students;
public ObservableCollection<Student> Students
{
get { return _students; }
set
{
_students = value;
RaisePropertyChanged("Students");
}
}
private void InitiList()
{
Students = new ObservableCollection<Student>();
Students.Add(new Student { Name="a",College="aa"});
Students.Add(new Student { Name = "b", College = "aa" });
Students.Add(new Student { Name = "c", College = "aa" });
Students.Add(new Student { Name = "d", College = "aa" });
Students.Add(new Student { Name = "e", College = "aa" });
}
检查这个 o/p 图像: