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

Aperta Adatta ai principianti
#4,118 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@corvinsz ci sta già lavorando.

Dal 2/11/2026.

  • #4119 di @corvinsz — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
desktop

Direzione di ricerca

Il bug si trova in src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml, intorno alla riga 811, dove lo stile MaterialDesignChoiceChipListBoxItem associa RadioButton.GroupName alla ListBox padre senza Path=Name. Confrontalo con gli stili fratelli dei chip Primary e Secondary, vicino alle righe 839 e 866, che si associano al Name della ListBox. Il lavoro è completo quando lo stile predefinito si associa nello stesso modo di quelli fratelli e due ListBox con lo stesso numero di elementi non cancellano più reciprocamente la selezione. Verifica se esiste un test WPF o un progetto di esempio che copra i choice chip, e tieni presente che la issue #3473 è stata chiusa in precedenza senza una correzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C#
Stelle
16.3k
Fork
3.5k
Merge medio
2g 7h
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MaterialDesignInXAML/MaterialDesignInXamlToolkit

Tutte le issue di MaterialDesignInXAML/MaterialDesignInXamlToolkit

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.