bug: WinForms ViewModelViewHost does not apply DefaultContent when no view is found
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
Đọc src/ReactiveUI.Winforms/ViewModelViewHost.cs, đặc biệt là UpdateContentForViewModel, và so sánh hành vi dự phòng của nó với src/ReactiveUI.Wpf.Shared/Common/ViewModelViewHost.cs. Kiểm tra các bài kiểm thử WinForms cho ViewModelViewHost và bổ sung kiểm thử cho trường hợp view model khác null nhưng không thể phân giải được view. Hoàn thành khi host hiển thị DefaultContent trong trường hợp đó nếu thuộc tính này được thiết lập.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
ReactiveUI.Winforms.ViewModelViewHost and the WPF ViewModelViewHost handle "no view found" differently. Reported in discussion #3722.
WPF (src/ReactiveUI.Wpf.Shared/Common/ViewModelViewHost.cs, line 168) always falls back to the default:
Content = viewInstance ?? DefaultContent;
WinForms (src/ReactiveUI.Winforms/ViewModelViewHost.cs, UpdateContentForViewModel, lines 206-232) applies DefaultContent only when the view model is null. When the view model is not null but ResolveView returns null (for example after ViewContractObservable changes to a contract that has no registered view), the method returns early and Content keeps the previous view:
var view = _resolveView(ViewLocator ?? GetCurrent(), viewModel, contract);
if (view is null)
{
return;
}
Expected: when no view resolves, the WinForms host shows DefaultContent (when set), the same as WPF.
- Ngôn ngữ chính
- C#
- Star
- 8.6k
- Fork
- 1.1k
- Merge trung bình
- 17 giờ 31 phút
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 reactiveui/ReactiveUI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reactiveui/ReactiveUI#4588 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dependency DashboardĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
reactiveui/ReactiveUI#3737 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của reactiveui/ReactiveUI
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
effort:S P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
nightscout/nocturne#4930 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 91/100
reactiveui/Akavache#1278 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FOODPLANNER Subtask
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
aau-giraf/foodplanner-api#314 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
juandresrodca/AdminForge#70 ·
Maintainer thường phản hồi trong vòng 1 ngày