Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8838779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:05:29+00:00 2026-06-14T10:05:29+00:00

im writing an Windows Store Application. I have an View(FavoritenGrid) with an GridView. This

  • 0

im writing an Windows Store Application.
I have an View(FavoritenGrid) with an GridView.
This View works with a DataContext(FavoritenViewModel).
And the DataContext has a List(FavList).

Now i want to get the latest FavList when i load the View.

Code snippets:

public FavoritenGrid()
{
    this.InitializeComponent();
    _vm = ((FavoritenViewModel)this.DataContext);
     ((DataViewModel)this.DataContext).LoadDataCommand.Execute(null);
    groupedItemsViewSource.Source =  _vm.FavList;
    (semanticZoom.ZoomedOutView as ListViewBase).ItemsSource = groupedItemsViewSource.View.CollectionGroups;
}

FavoritenViewModel List

 private ObservableCollection<FavoritenGroup<Draggable>> _favList;

public ObservableCollection<FavoritenGroup<Draggable>> FavList
{
    get { return _favList; }
    set
    {
        _favList = value;
        RaisePropertyChanged("FavList");
    }
}

FavoritenViewModel Loading method

 private async Task loadData()
 {
    IsLoading = true;

    FavList =  new ObservableCollection<FavoritenGroup<Draggable>>();
    FavList = await getFavoriten();

    IsLoading = false;
 }

If i dont initialize the List with an empty List i get a NullPointerException.

FavList =  new ObservableCollection<FavoritenGroup<Draggable>>();

This method loads the latest FavList. But its not shown in the View, i have to leave the View and load it again to see the changes.

FavList = await getFavoriten();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:05:30+00:00Added an answer on June 14, 2026 at 10:05 am

    Your view won’t update in this instance because the ObservableCollection is not being updated, it is being replaced.

    If I were you, I would do the following.

    FavoritenViewModel

    private ObservableCollection<FavoritenGroup<Draggable>> _favList = new ObservableCollection<FavoritenGroup<Draggable>>();
    public ObservableCollection<FavoritenGroup<Draggable>> FavList
    {
        get { return _favList; }
        set
        {
            _favList = value;
            RaisePropertyChanged("FavList");
        }
    }
    

    and then remove the FavList = new ObservableCollection<FavoritenGroup<Draggable>>(); in the loadData() method.

    Next, when you are updating your list, instead of creating a new collection (thereby replacing your ObservableCollection) I’d try to remove items that don’t exist any more, and add new ones if they are not already on the list. (You could Clear() the items, and then add all your new ones. This will update the existing collection and should fire the event to update the UI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a Windows Store App toy application for Windows 8. It has
I am writing a .net(C#) windows application to store user passwords in it, like
I'm writing application on C# (WPF) for Windows. I need to store data for
I am writing a windows application in Lazarus/FreePascal (like Delphi). I have a TDataset
I am using this article of architecture http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/ I have this one function where
I am writing Windows application (with Borland C++ Builder), which stores large number of
We're writing Windows desktop apps using C++ and Win32. Our dialog boxes have an
I'm writing a windows application that is embed with a manifest considering UAC in
I'm writing a Windows Service in C#. I have a samba share on a
I am writing a Windows CE application in C# that references a native C++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.