-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
3 - M (<= 1 month)
-
1759
Goals
Hello. I'm getting started with Realm platform to make an application in sync.
The problem is that the data in my view does not become synced with db and I need to fetch it again.
Expected Results
I want to add a data to database and I want the data list to be in sync with DB.
I bonded the ListView to an IRealmCollection.
Actual Results
When I add the data in the db using
var todo = new Todo() { Id = DateTime.UtcNow.Ticks.ToString(), Subject = DateTime.Now.ToString(), Detail = Details.Text, Status = 2 }; RealmContext.Instance.Write(() => { RealmContext.Instance.Add(todo); });
it saves successfully but the point is that UI does not update itself with newly added data; so I need to fetch the data again with RealmContext.Instance.All<Todo>().AsRealmCollection(); which is not what I want. When I subscribe to changes via
TodayList.CollectionChanged += (s, e) =>
{
foreach (var item in TodayList)
{
Debug.WriteLine(item.Subject);
}
};
the fun fact is that it is not triggered when I insert my first data into the db. it triggers second time.
Even more fun is this, the VS debug output shows all items that I've added except the one that it didn't trigger this event !!! Please help.
Code Sample
You can take a look at the project that I'm working on at HERE
In the core project there are everything related to the Database.
Also TimelineViewModel.cs file is related to the issue.
Views>Add>Task.xaml is for adding an item to DB.
Version of Realm and Tooling
- Realm Object Server Version: Last version. On the cloud
- Client SDK Version: Windows 10 SDK 17134
- Client OS & Version: 3.1.0