Attribute [Ignored]


Do properties decorated with the C# attribute [Ignored] implement INotifyPropertyChanged?


No, these are not modified by Realm.


I am trying to learn the accordion. There is a variable to toggle it in the listview row visibility. Can I hard code a INotifyPropertyChanged property without breaking the magic behind the RealmObject? If I persist the visibility field a realm transaction exception is thrown.


You can do anything in the property implementation of ignored properties. That being said, you have to be aware that ignored properties are not persisted and are not shared between different Realm objects. Also, it may not be intuitive, but Realm objects are never cached, including in collections, so accessing the same element twice returns different instances of the same database object. To try and explain what I mean, imagine this model:

class Dog
    // Persisted
    public string Name { get; set; }

    public bool IsVisible { get; set; }

var dogs = realm.All<Dog>();
var dogA = dogs.ElementAt(0);
var dogB = dogs.ElementAt(0);

// dogA and dogB are the same Realm object, but different instances

dogA.Name == dogB.Name; // true
dogA.IsVisible == dogB.IsVisible; // true

realm.Write(() =>
    dogA.Name = "123";

dogA.Name == dogB.Name; // true - "123"
dogA.IsVisible = true;
dogA.IsVisible == dogB.IsVisible; // false