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

未关闭 适合新手
#4,118 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@corvinsz 已经在做这个了。

开始于 2026年11月2日。

  • #4119 来自 @corvinsz —— 未关闭

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
desktop

调研方向

该缺陷位于 src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml 约第 811 行,MaterialDesignChoiceChipListBoxItem 样式在这里将 RadioButton.GroupName 绑定到父级 ListBox,但没有使用 Path=Name。请将其与第 839 行和第 866 行附近的 Primary 和 Secondary 芯片同级样式进行比较,这些样式绑定到 ListBox 的 Name。当默认样式与这些同级样式的绑定方式一致,并且两个项目数相同的 ListBox 不再互相清除选择时,即视为完成。请检查是否有覆盖选择芯片的 WPF 测试或示例项目,并注意 issue #3473 此前已在未修复的情况下关闭。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
C#
星标
16.3k
派生
3.5k
平均合并
20 小时 51 分钟
30 天内合并 PR
7

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MaterialDesignInXAML/MaterialDesignInXamlToolkit 的其他 Issue

查看 MaterialDesignInXAML/MaterialDesignInXamlToolkit 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。