1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【WPF Prism】ExcelみたいにDataGridを抽出したかった

Posted at

はじめに

Microsoft Excel のように、テーブルの列をフィルタしたかった

(完成イメージ)実際のエクセルのフィルタの様子

きっかけ

  • Qiita の Q&A ? に同じ動機をもった方の質問が投稿されていた
  • Prism とか ReactiveProperty とかつかえば、できそうな気がした

結果として、けっこう時間かけた割には納得できたものはできなかった・・・

諸条件

  • .NET Core 3.1
  • Windows 10

実際に動くもの

一見は百聞に如かず、なので、とりあえず動くものの様子(GIF動画)

テーブルのフィルタリング

Animation3.gif

フィルタリング候補自体のフィルタリング

Animation4.gif

うまく解決できなかったところ

今後解消するかわからないけど、つまづいて今なお解決できていないところを書き残す

DataGridの列インデックスが取得できない

DataGridには、列が3つ存在している
DataGrid.Columnsプロパティは配列になっている
DataGrid.Columnsの添え字[0]を開くと、DisplayIndexがあり、たしかに0となっている

image.png

ヘッダーの▼を押したときに、このDisplayIndexをダイアログに渡したいのだが、できなかった
Datatemplateから自分の列のインデックスがわからない

参考にさせていただいた記事など

DataGrid のヘッダーをカスタマイズする関連

バインディング全般

有償コンポーネントなど

自分はつかったことないけど、会社名くらいは知っている

.NET の有償コンポーネントの一覧には、だいたいエクセルチックなコンポーネントも1つは含まれている

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?