Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Refreshing all properties of an ObservableObject

Abierto
#1,160 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
csharp

Línea de trabajo

Comienza con ObservableObject y su ruta OnPropertyChanged(null), y luego investiga cómo el extremo receptor gestiona un nombre de propiedad null en escenarios AOT. Compara el método propuesto de enumeración de propiedades con las notificaciones individuales automáticas y define qué comportamiento y API permitirían actualizar todas las propiedades observables sin reflexión.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

This issue falls in between a feature request and a bug.

Given a case scenario you want to refresh all the properties of an ObservableObject, the recommended pattern is this:

public void RefreshAllProperties() => OnPropertyChanged(null);

Raising a property changed as null is usually the suggested approach to signal that all properties are changed.

The problem with this pattern is that it assumes the receiving end is able to list (via reflection) all the properties that are bound for refreshment.

But when you're in an AOT scenario, I am wondering if, in this crippled scenario where reflection is not possible, how to resolve this.

I think the solution for this would be, if AOT is detected, instead of raising a single null property change, to raise a sequence of indivisual property changes, one for every observable property.

And, I think this can be done in two ways:

1- to have a protected method that enumerates all the observable properties (something that could be usefull for other scenarios, like populating PropertyGrid controls) , and the let the developer implement its own RefreshAllProperties();

2- to make OnPropertyChanged(); smarter, by detecting when a null argument is passed, and if it detectes its in AOT, instead of relaying the null, to swich to raise a propertychange sequence.

Btw, I'm relatively new to CommunityToolkit.mvvm , so I wrote this issue under the assumption there's no way to do this other to manually raise all the property changes.

Lenguaje dominante
C#
Estrellas
3.8k
Forks
401
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de CommunityToolkit/dotnet

Todos los issues de CommunityToolkit/dotnet

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.