DataGrid ComboBox: keyboard-focused item uses an undefined brush key (MaterialDesign.Brush.TextBox.ComboBoxHover)

オープン 初心者向け
#4,124 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp
領域
desktop-dev

調査の方向性

問題は src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml の60行目付近、アイテムコンテナーテンプレートのキーボードフォーカス用 MultiTrigger にあります。そこで使われているキーを、53行目のマウスオーバー用トリガーのキーと比較し、MaterialDesignTheme.Light.xaml と Dark.xaml の両方で定義されているか確認してください。矢印キーでフォーカスを移動したときに、フォーカスされた項目がハイライトされれば完了です。サンプルアプリの DataGrid ComboBox を実行して確認できます。

索引モデルが issue の本文から書いたものです。

説明

Bug explanation

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml, line 60, in the item container template of the DataGrid ComboBox:

<MultiTrigger>
  <MultiTrigger.Conditions>
    <Condition Property="IsSelected" Value="False" />
    <Condition Property="IsKeyboardFocused" Value="True" />
  </MultiTrigger.Conditions>
  <Setter TargetName="Bd" Property="Background" Value="{DynamicResource MaterialDesign.Brush.TextBox.ComboBoxHover}" />
</MultiTrigger>

No resource with the key MaterialDesign.Brush.TextBox.ComboBoxHover is defined anywhere in the repository (GitHub code search finds only this line). The trigger right above it — the mouse-over case, line 53 — uses MaterialDesign.Brush.DataGrid.ComboBoxHover, which is defined in both MaterialDesignTheme.Light.xaml and MaterialDesignTheme.Dark.xaml (line 39), and lines 171 and 297 use the same key. So this looks like the keyboard-focus trigger was meant to use it too.

Since it is a DynamicResource, nothing throws: the background just doesn't change when an item gets keyboard focus, so someone moving through the dropdown with the arrow keys gets no highlight on the focused item. I found this by reading the source and haven't run it, so apologies if I'm missing something.

Suggested change (line 60):

<Setter TargetName="Bd" Property="Background" Value="{DynamicResource MaterialDesign.Brush.DataGrid.ComboBoxHover}" />

The line is the same in 5.4.0 and on master at 0877280.

Found with XamlKeys, a static checker for XAML resource keys I'm working on.

Version

5.4.0

主要言語
C#
スター
16.3k
フォーク
3.5k
平均マージ
4時間 25分
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MaterialDesignInXAML/MaterialDesignInXamlToolkit のほかの issue

MaterialDesignInXAML/MaterialDesignInXamlToolkit の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。