none
[UWP]UWP save ObservableCollection<T> to persistency RRS feed

  • Question

  • Hello,

    I have an UWP application where my MainPage has a ObservableCollection<T> member which consists of user data, and it is set as an ItemsSource to a DataGrid.

    I'd like to save this collection to a persistent storage when it changes, is there an API I could use to do that?


    Sunday, August 19, 2018 10:26 AM

Answers

  • Hi Metonimie,

    >>”I'd like to save this collection to a persistent storage when it changes, is there an API I could use to do that?”

    The first, how to know the collection is changed? You could register the ObservableCollection<T>.CollectionChanged event.

    The second, the UWP supports saving data into SqlServer database. Please see Use a SQL Server database in a UWP app for more details.

    Best Regards,

    Xavier Xie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, August 20, 2018 8:41 AM
    Moderator

All replies

  • Hi Metonimie,

    According to your description, your issue is related UWP, I will move your thread to UWP forum for professional help.

    Thanks for your understanding and support.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 20, 2018 1:24 AM
  • Hi Metonimie,

    >>”I'd like to save this collection to a persistent storage when it changes, is there an API I could use to do that?”

    The first, how to know the collection is changed? You could register the ObservableCollection<T>.CollectionChanged event.

    The second, the UWP supports saving data into SqlServer database. Please see Use a SQL Server database in a UWP app for more details.

    Best Regards,

    Xavier Xie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, August 20, 2018 8:41 AM
    Moderator