Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Update ListView in the MasterDetailPage.

$
0
0

I need to update the title of an item of the ListView in master page, but once it is created, not let me change it:

How could I do this?

Show some example code:

public partial class MasterPageMain : ContentPage
{
    private List<Items> masterPageItems;

    public MasterPageMain() {
        InitializeComponent();

        masterPageItems = new List<Items>();

        masterPageItems.Add(new Items {
            Title = "Profile",
            ImageSource = "profile",
            TargetType = typeof(ProfilePage)
        });

        masterPageItems.Add(new Items {
            Title = "Notifications",
            ImageSource = "notifications",
            TargetType = typeof(NotificationsPage)
        });

        listView.ItemsSource = masterPageItems;

        test();
    }

    private async void test() {
        await Task.Delay(1000);
        masterPageItems.ElementAt(1).Title = "Notifications (5)";
    }
}

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>