Refreshing all properties of an ObservableObject
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp
- Lĩnh vực
- developer-experience
Hướng nghiên cứu
Bắt đầu với ObservableObject và đường dẫn OnPropertyChanged(null) của nó, sau đó điều tra cách phía nhận xử lý tên thuộc tính null trong các kịch bản AOT. So sánh phương thức liệt kê thuộc tính được đề xuất với các thông báo riêng lẻ tự động, và xác định hành vi cùng API nào sẽ giải quyết việc làm mới tất cả các thuộc tính có thể quan sát mà không cần reflection.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 3.8k
- Fork
- 403
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CommunityToolkit/dotnet
-
RelayCommand<T>.CanExecute(null) returns false for value types without a predicateCó thể đã có người làm @apachezy đã nhận 88 ngày trước. Đang mởbug :bug:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
CommunityToolkit/dotnet#1206 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
CommunityToolkit/dotnet#648 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
CommunityToolkit/dotnet#1217 ·
-
bug :bug:
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
CommunityToolkit/dotnet#1215 ·
Tất cả issue của CommunityToolkit/dotnet
Issue tương tự
-
area: client bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug mcp misleading small
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug Platform: Android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-dotnet#5764 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/SimpleL7Proxy#287 ·
Maintainer thường phản hồi trong vòng 1 ngày