Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Using Command and ComboBox is not working in SettingsExpander.Items

未关闭
#445 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
csharp
领域
desktop

调研方向

从提供的 WinUI 3 XAML 复现开始,重点关注 SettingsExpander.Items、嵌套的 ComboBox、EventTriggerBehavior 和 InvokeCommandAction。使用嵌套的 SettingsCard 复现选择更改,然后追踪为什么不会调用 ViewModel.IconPackChangedCommand。当 command 在此布局中的执行方式与没有 SettingsExpander.Items 时一致时,即表示完成。

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

描述

bug :bug: external :arrow_heading_up: WinUI :diamond_shape_with_a_dot_inside:
Describe the bug

if we use MvvM Command in ComboBox and SettingsExpander.Items, The command is not executed.

Steps to reproduce
this is my xaml:


<wuc:SettingsExpander Description="Choose Icon Pack to display for the season number"
                                  Header="Icon Pack"
                                  IsExpanded="True">
                <wuc:SettingsExpander.Items>
                    <wuc:SettingsCard Description="Choose Icon Pack to display for the season number"
                                      Header="Icon Pack"
                                      HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/iconPack.png}">
                        <ComboBox Name="cmbIconPack">
                            <ComboBoxItem Content="Glyph" Tag="Glyph" />
                            <ComboBoxItem Content="Fluent" Tag="Fluent" />
                            <i:Interaction.Behaviors>
                                <ic:EventTriggerBehavior EventName="SelectionChanged">
                                    <ic:EventTriggerBehavior.Actions>
                                        <ic:InvokeCommandAction Command="{x:Bind ViewModel.IconPackChangedCommand}" CommandParameter="{Binding ElementName=cmbIconPack}" />
                                    </ic:EventTriggerBehavior.Actions>
                                </ic:EventTriggerBehavior>
                            </i:Interaction.Behaviors>
                        </ComboBox>
                    </wuc:SettingsCard>
                </wuc:SettingsExpander.Items>
            </wuc:SettingsExpander>

if i dont use SettingsExpander.Items everything is working normal, but if i use SettingsExpander.Items command is not working



### Expected behavior

command should be working!

### Screenshots

_No response_

### Code Platform

- [ ] UWP
- [X] WinAppSDK / WinUI 3
- [ ] Web Assembly (WASM)
- [ ] Android
- [ ] iOS
- [ ] MacOS
- [ ] Linux / GTK

### Windows Build Number

- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [X] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Other (specify)

### Other SDK version

_No response_

### Visual Studio Version

2022

### Visual Studio Build Number

_No response_

### Device form factor

Desktop

### Additional context

_No response_

### Help us help you

No, I'm unable to contribute a solution.
主要语言
C#
星标
484
派生
89
平均合并
2 天 18 小时
30 天内合并 PR
1

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

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

从这里开始

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

CommunityToolkit/Labs-Windows 的其他 Issue

查看 CommunityToolkit/Labs-Windows 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

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