【问题标题】:Removing Items from Gridview and refreshing the gridview without redirecting to the same Page.(Windows Phone 8.1 Xaml)从 Gridview 中删除项目并刷新 gridview 而不重定向到同一页面。(Windows Phone 8.1 Xaml)
【发布时间】:2023-03-20 03:05:01
【问题描述】:

我有一个以 Usercontrol 作为其 itemtemplate 的 gridview。

在用户控件中,我附加了一个浮出控件,用户可以使用它选择删除条目。删除后如何删除条目/更新gridview而不重定向到samePage并删除backstack条目?

请注意,我正在删除/修改用户控件的代码隐藏 buttonclick 事件中的 itemssource。

【问题讨论】:

    标签: gridview user-controls windows-phone-8.1 itemtemplate flyout


    【解决方案1】:

    如果您的 itemssource 实现了 INotifyCollectionChanged,它将自动在 GridView 中反映 Addition 和 Removals。

    你可以使用ObservableCollection作为ItemsSource,它已经实现了。

    当然,您可以直接使用 GridView.Items.Remove(或 RemoveAt)删除项目。

    【讨论】:

    • 谢谢 :) 得到它的工作,但忘记在这里更新答案 :)
    猜你喜欢
    • 2014-10-30
    • 1970-01-01
    • 1970-01-01
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多