Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何更新 GridView 的内容。即最初我将数据绑定到 GridView 并且一旦我更新了数据库,我必须清除现有项目并绑定更新的项目。
你说你已经绑定了GridView?在这种情况下,您有两种选择:
GridView
您可以将其绑定到ObservableCollection将在 UI 发生更改时通知 UI 的对象。这意味着您可以只清除此集合以删除旧项目,然后将新的更新项目添加到其中。
ObservableCollection
或者,您可以INotifyPropertyChanged在包含要绑定的集合的类上实现GridView,并PropertyChanged在将包含旧项目的集合替换为包含更新项目的新集合时引发。
INotifyPropertyChanged
PropertyChanged
如果您发布一些显示您当前正在做什么的代码,会更容易为您提供帮助。