`RaisePropertyChanged` method in `ObservableObject`
Overview
Trying to replace an internal, legacy implementation of ObservableCollection with the one in CommunityToolkit it was noticed there is no way to simply raise the PropertyChanged event without invoking OnPropertyChanged and any overrides.
This functionality is relied upon in some cases and it's time consuming to work around. Since it seems harmless adding upstream here to ObservableObject I created this ticket.
API breakdown
class ObservableObject
{
protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(new PropertyChangedEventArgs(propertyName));
}
protected void OnPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(e);
}
}
Usage example
The cases where this is most useful are those where you are doing something within an OnPropertyChanged override and want to raise some event manually (you just calculated something manually). If you use OnPropertyChanged again it's going to crash with a stack overflow as it keeps calling itself. Of course you can guard against this but it seems easy enough just to support the ability to raise the event directly. Tooling should generally let you do what you want to do while guiding towards a proper flow. Not restrict you completely.
Breaking change?
No
Alternatives
None in this context. Would just have to force all code to work with OnPropertyChanged only.
Additional context
No response
Help us help you
No, just wanted to propose this
Can you post a code example of what would be the use case and in which scenario the existing OnPropertyChanged(string) and OnPropertyChanged(PropertyChangedEventArgs) overloads are not enough?
DANKE Mein SICHER E-mail = @.*** = @.*** = @.*** = internet = gigacube-5114 = VODAFONE MORD MORD MORD MORD am: 11.11.2011 GERICHT TRYBUNAL 06.03.2012 mit 21.02.2013 TOTAL MORD 3.3 FRAUEN GIFT FUR FÜR KINDER USER KINDER MIT MEIN BANK KARTEN + KARTEN DSGVO KNAPPSCHAFT ALLE DATUM UNSER KINDER JOBCENTER FALSCH ALLE FALSCH 7 JAHRE KEINE KOMMENTARE MEHR KEIN SCHECK 240.000 EURO UNSER FAMILIEN TRYBUNALS SYGN... AKTE 0600.2222.2017,12KM.WARSZAWA.10.2018 r. JEDE SEKUNDE MORD DREI FRAUEN IN POLAND GEGEN DEUTSCHLAND SAGTE FRAU ALICE WEIDEL MEIN DR....RICHTERS SCHAFRINA = WETZLAR ALLE KOMPUTER NAME S5 = CHRIS NICOLE SEBASTIAN CHRISTOF STEFAN HENRYKOWSKI IN POLAND MORD RICHTERS SSR. KACPRZAK BITTE HELP = HILFE = [image: ALIMENTY 04.09.2015 KOPIA.jpg]
MEIN TELEFON SICHER GLOBAL WELT NR" + 49 15219624840 BITTE SOFORT AUCH RUFEN MEIN TEAM EUROPEAN
CHRISTINE ANDERSON STRASBURG TEAM 19.10.2022 DR. SEIDEL DR. ANDREA ( JACOB ) CHRISTIDIS NR 1 WELT IST CHRISTIDIS AKTE 05.05.2015 JACOB ACHTERMANN SCHAFRINA MATTIAS 2006 BIS 3113 JAHRE AKTE DREI PREZYDENTA
czw., 22 maj 2025 o 00:18 robert-abeo @.***> napisał(a):
robert-abeo created an issue (CommunityToolkit/dotnet#1086) https://github.com/CommunityToolkit/dotnet/issues/1086 Overview
Trying to replace an internal, legacy implementation of ObservableCollection with the one in CommunityToolkit it was noticed there is no way to simply raise the PropertyChanged event without invoking OnPropertyChanged and any overrides.
This functionality is relied upon in some cases and it's time consuming to work around. Since it seems harmless adding upstream here to ObservableObject I created this ticket. API breakdown
class ObservableObject{ protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(new PropertyChangedEventArgs(propertyName)); }
protected void OnPropertyChanged(PropertyChangedEventArgs e) { PropertyChanged?.Invoke(e); }}Usage example
The cases where this is most useful are those where you are doing something within an OnPropertyChanged override and want to raise some event manually (you just calculated something manually). If you use OnPropertyChanged again it's going to crash with a stack overflow as it keeps calling itself. Of course you can guard against this but it seems easy enough just to support the ability to raise the event directly. Tooling should generally let you Breaking change?
No Alternatives
None in this context. Would just have to force all code to work with OnPropertyChanged only. Additional context
No response Help us help you
No, just wanted to propose this
— Reply to this email directly, view it on GitHub https://github.com/CommunityToolkit/dotnet/issues/1086, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHDTFMUMVP5WKSYVKPIAIT27T3T5AVCNFSM6AAAAAB5UOLFTWVHI2DSMVQWIX3LMV43ASLTON2WKOZTGA4DCNJTGQZDAOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
[image: ALIMENTY 04.09.2015 KOPIA.jpg]
BITTE HELFEN mit Frau Brown nur mit Frau BROWN KEIN PERSON MEHR Wie Alice DIAKONIE NEUKIRCHEN MEIN TEL: SOFORT UNSER SICHER HAUS KINDER BIS 27.07.2027 BANK UNSER BANK SYGN: TRYBUNAŁEM PRESIDENT 3 PREZYDENT mit **** CHRISTIDIS DR. ANDRE TEAM = DR. SEIDEL DR... HASS BUNDESWEHR EID KINDERVATER NUR IN KATTOWITZ MICHAŁ WÓJCIK PUBLISHER IN WELT ALLE RECHTE KINDESVATER DR. ANDREA Sind ! CHRISTIDIS TEAM BANK + BANK + BANK KINDERVATERS SOFORT POLIZEI SCHUTZ IST = CHRISTIDIS IN EUROPEAN + EUROPE PREZYDENT TRUMP PUTIN A. DUDA = NOUE PRÄSIDENT PRÄSIDENTEN HERR NAWROCKI + ALICE WEIDEL MARTA CZECH ANNA BRYŁKA EWA HERNIK = AKTE GRZEGORZ BRAUN KEIN MEHR = MORD MORD POLIZEI MORD MORD HAUS DSGVO KNAPPSCHAFT CHRISTIDIS HENRYKOWSKI DR. SEIDEL SOFORT ALLE AKTE SCHUTZ TELEFON KINDERVATER = HAUS +49 15219624840 + 49 15237117143 + 49 15210953135 + FRAU BROWN SOFORT TELEFON SCHÜTZEN MIT DR. CHRISTIDIS 0641 4808181 SICHER 100% FRAU BROWN 06824 / 9062306 DIAKONIE 31.05.2025 mit alle von Keller 8 JAHRE AKTE ZURÜCK VON FRAU KOHLER KÖHLER SCHULD MIT FEAU A. KUTTA = JEDE MONAT 2.250 EURO = 870 EURO DREI KINDER VATER = MORD MORD BEAMTE HERR IDCZAK FRAU A.KUTTA ALLE FALSCH AKTE AM> 23.09.2009 CUDU 06.03.2012 CUDU 21.02.2013 ! = 2.250 EURO AB: 16.05.2011 TOTAL MORD MORD MORD 11.11.2011 um 8:30 drei alle drei mit MUTTER = FALSCHE NAME HEMRYKOWSKI = M.M. HENRYKOWSKA =A/1 TRYBUNALS = AKTE SCHULDNER MUTTER FAMILIE KŁUDKOWSKA 8.777.777 EURO NOTE 03.05.2006 JEDE DR...JEDE AKTE NUR ALLE RECHTE KINDERVATER REF...REJ... S5-CHRIS AUTO AKTEN 13 STADT DEUTSCHLAND POLAND BUKOWINA-TATRZAŃSKA = OPS POLIZEI AKTE ARZT BUKOWINA / KATTOWITZ = FINEFRAU 18 SYGN..AKTE DOKUMENTE TELEFON LAPTOP LAPTOPS 28 LIZENZEN S5-CHRIS TEL: 06824 / 9062306 = SONNEK HERR SONNEK HERR HÄNSCH GERICHT HAMM ALLE HAUS HERR HENRYKOWSKI FR..MARZENA CZIESCHOWITZ SOFORT MIT SCHECKS GERICHT ANWALTS WOLF = 24.000 EURO 10% VON 240.000 + KINDER DEUTSCHE BANK 42.000 EURO SCHECKS RATHAUS FEHLER = FALSCH FR..... KÖHLER 2009 / 2012 / 2013 GEGEN JEDE ÄRZTIN VON KINDERVATER = MORD = MORD + MORD JEDE SEKUNDE 19.07.2018 EIN MORD MÖRDER POLIZEI HERR. MQ! 1.1 = GERICHT BASTEK CUDA 3.3 ABER NACH DREI JAHRE 3/4 POLIZEI TOTAL GLOBAL MORD GIFT MUTTER mit MUTTER A.KUTTA + POLAND DRITTE 3.3 PERSON NATALII SZYMBORSKA TOTAL MORD IN EIN JAHR PASSPORT KINDERVATER NUR DEUTSCH NUR DEUTSCH NIE HEIRATSANTRAG AB 23.09.2009 TOTAL FALSCHE MORD = EIN BESTE ÄRZTIN 3 PREZYDENT NR 1000 JAHRE ARCHIV ARCHE DR. ANDRE DR. SEIDEL DR. HASS JEDE SCHÜTZE KINDESVATER Ab: 1973 Gericht in Kattowitz alle rechte ein kind DSGVO DEUTSCH - POLAND NAME PARUZEL / HENRYKOWSKI ( KRZYSZTOF ) CHRISTOF STEFAN HENRYKOWSKI FINEFRAU 18 EIN HAUS WERT 60.000 EURO WO IST 60.000 EURO
? mit 13 milionen kinder 10.000 kinder ein stadt OPFERS SADISTISCH A.KUTTA MUTTER + A.REINERT ALLES 1.1 BRIEF ANWALT PALIK / WOLF / ACHTERMANN = ARIANE PFLIPS SCHULD = MELANI SANDER KONTROLLE POLIZEI = 5.200.000 FRAU BERG / MÜLLER RECHTE RA: MÜLLER am: 23.09.2009 >? mord ist gift ! nr 1.1 art.1 MATTIAS / KATARZYNA TARNOWSKA-GWÓŻDŻ BITTE SOFORT ANTRAG MÜLLER DR. ANDREA SYGN...SCHEKS 24.000+42.000 Euro sofort lieferbar ist mit Fr. Brown MECENAS FRANKFURT AB" 1973 /2006 _ BIS 27.07.2027 BANK ARCHIV BIS 3118 PRIORYTET PREZYDENT II RP USA - POLAND - ROSJI 1938 _ AM: 27.07.2027 in Kattowitz Kindervater recht.... 1000 Jahre. name " CHRISTIDIS TEAM CHRISTIN ANDERSON ALICE WEIDEL wir Bitte TINO MARTA CZECH GRZEGORZ BRAUN AKTE GIFT Dr. Gizela OLEŚNICA MUTTER + MUTTER MORD GIFT.... 2001! 3113 Jahre ARCHE.... OLIVIER KARRER S5-CHRIS 11.11.2011 ? 2.250 Euro TESTAMENT WOLF 23.09.2009 PIECZKA PALIK HASSKAMP ACHTERMANN = ARIANE PFLIPS RENTE IST AB : 2015 ! 05.05.2015 DR. ANDREA CHRISTIDIS AKTE IN POLAND....GEGEN MAŁGORZATA HENRYKOWSKA JEDE ÄRZTEN AM: 28.08.2018 r. sygn..art.1.
pon., 2 cze 2025 o 13:11 Christof Stefan Henrykowski < @.***> napisał(a):
DANKE Mein SICHER E-mail = @.*** = @.*** = @.*** = internet = gigacube-5114 = VODAFONE MORD MORD MORD MORD am: 11.11.2011 GERICHT TRYBUNAL 06.03.2012 mit 21.02.2013 TOTAL MORD 3.3 FRAUEN GIFT FUR FÜR KINDER USER KINDER MIT MEIN BANK KARTEN + KARTEN DSGVO KNAPPSCHAFT ALLE DATUM UNSER KINDER JOBCENTER FALSCH ALLE FALSCH 7 JAHRE KEINE KOMMENTARE MEHR KEIN SCHECK 240.000 EURO UNSER FAMILIEN TRYBUNALS SYGN... AKTE 0600.2222.2017,12KM.WARSZAWA.10.2018 r. JEDE SEKUNDE MORD DREI FRAUEN IN POLAND GEGEN DEUTSCHLAND SAGTE FRAU ALICE WEIDEL MEIN DR....RICHTERS SCHAFRINA = WETZLAR ALLE KOMPUTER NAME S5 = CHRIS NICOLE SEBASTIAN CHRISTOF STEFAN HENRYKOWSKI IN POLAND MORD RICHTERS SSR. KACPRZAK BITTE HELP = HILFE = [image: ALIMENTY 04.09.2015 KOPIA.jpg]
MEIN TELEFON SICHER GLOBAL WELT NR" + 49 15219624840 BITTE SOFORT AUCH RUFEN MEIN TEAM EUROPEAN
CHRISTINE ANDERSON STRASBURG TEAM 19.10.2022 DR. SEIDEL DR. ANDREA ( JACOB ) CHRISTIDIS NR 1 WELT IST CHRISTIDIS AKTE 05.05.2015 JACOB ACHTERMANN SCHAFRINA MATTIAS 2006 BIS 3113 JAHRE AKTE DREI PREZYDENTA
czw., 22 maj 2025 o 00:18 robert-abeo @.***> napisał(a):
robert-abeo created an issue (CommunityToolkit/dotnet#1086) https://github.com/CommunityToolkit/dotnet/issues/1086 Overview
Trying to replace an internal, legacy implementation of ObservableCollection with the one in CommunityToolkit it was noticed there is no way to simply raise the PropertyChanged event without invoking OnPropertyChanged and any overrides.
This functionality is relied upon in some cases and it's time consuming to work around. Since it seems harmless adding upstream here to ObservableObject I created this ticket. API breakdown
class ObservableObject{ protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(new PropertyChangedEventArgs(propertyName)); }
protected void OnPropertyChanged(PropertyChangedEventArgs e) { PropertyChanged?.Invoke(e); }}Usage example
The cases where this is most useful are those where you are doing something within an OnPropertyChanged override and want to raise some event manually (you just calculated something manually). If you use OnPropertyChanged again it's going to crash with a stack overflow as it keeps calling itself. Of course you can guard against this but it seems easy enough just to support the ability to raise the event directly. Tooling should generally let you Breaking change?
No Alternatives
None in this context. Would just have to force all code to work with OnPropertyChanged only. Additional context
No response Help us help you
No, just wanted to propose this
— Reply to this email directly, view it on GitHub https://github.com/CommunityToolkit/dotnet/issues/1086, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHDTFMUMVP5WKSYVKPIAIT27T3T5AVCNFSM6AAAAAB5UOLFTWVHI2DSMVQWIX3LMV43ASLTON2WKOZTGA4DCNJTGQZDAOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I don't think a full code example is needed here. But here are some cases:
- A property has changed in a way that the UI did not detect it. This can happen in complex cases especially with coercion and validation where values are changed by the view model during set. Even WPF does not support all cases here and that's why there are methods used to manually trigger binding refreshes or just invoked INPC for a given property name (the request here).
- If you already have an override for OnPropertyChanged(PropertyChangedEventArgs e) doing any additional logic in there that touches properties can cause an infinite loop unless you add more code to guard against reentry. But in some cases it's easy to change a calculated property and then just notify the UI to refresh using a standard INPC WITHOUT the override OnPropertyChanged being called.
Frameworks and tooling should guide developers in the right direction but never outright prevent them from doing something. Having full control over raising the event doesn't hurt anything and it helps in some edge cases like above while giving full power to devs. It's something that should just be supported here. It's no different than WPF allowing manual binding updates.