MaterialDesignChoiceChipListBoxItem missing 'Path=Name' in GroupName binding causes selection conflict between ListBoxes

Đang mở Phù hợp với người mới
#4,118 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@corvinsz đang làm issue này rồi.

Từ ngày 2/11/2026.

  • #4119 của @corvinsz — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
desktop

Hướng nghiên cứu

Lỗi nằm trong src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml, quanh dòng 811, nơi style MaterialDesignChoiceChipListBoxItem ràng buộc RadioButton.GroupName vào ListBox cha mà không có Path=Name. Hãy so sánh với các style chip Primary và Secondary ngang hàng gần dòng 839 và 866, vốn ràng buộc vào Name của ListBox. Công việc hoàn tất khi style mặc định ràng buộc giống các style ngang hàng đó, và hai ListBox có cùng số lượng mục không còn xóa lựa chọn của nhau nữa. Hãy kiểm tra xem có bài kiểm thử WPF hoặc dự án mẫu nào bao phủ choice chip không, và lưu ý rằng issue #3473 đã được đóng trước đó mà không có bản sửa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug evaluation required
Bug explanation

style MaterialDesignChoiceChipListBoxItem binds RadioButton.GroupName to parent ListBox itself without specifying Path=Name.
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/087728011a8d71926ccf86cb28dc99439e9b1c3f/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml#L811

this causes RadioButton.GroupName to be something like System.Windows.Controls.ListBox Items.Count:4.
if 2 listboxes have same number of items, one listbox's selection 'clears' another listbox's selection.

other variations, such as MaterialDesignChoiceChipPrimaryListBoxItem, MaterialDesignChoiceChipSecondaryListBoxItem etc, bind RadioButton.GroupName to parent ListBox's Name property. so those styles do not have the problem as long
as parent ListBox has Name property specified.
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/087728011a8d71926ccf86cb28dc99439e9b1c3f/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml#L839
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/087728011a8d71926ccf86cb28dc99439e9b1c3f/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml#L866

this same issue was once opened as #3473 before, but the OP closed it thinking it was solved in 5.0.0.
but as of 5.4.0, the problem remains in the master branch.

thank you.

Version

5.4.0

Ngôn ngữ chính
C#
Star
16.3k
Fork
3.5k
Merge trung bình
5 giờ 15 phút
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của MaterialDesignInXAML/MaterialDesignInXamlToolkit

Tất cả issue của MaterialDesignInXAML/MaterialDesignInXamlToolkit

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.