[C# WPF] ファイルドラッグ&ドロップ中のマウスカーソル更新

マウスオーバーしている領域によって受け付けるファイルを変えたい。
ついでにドラッグしているファイルに合わせてマウスオーバーしたときにマウスカーソルも切り替えたい。
という私の要望に答えます。
[C# WPF] エクスプローラからのファイルドラッグ&ドロップ

ファイルをドラッグ&ドロップする処理を実装したい。
という要望が私の中にあったので書きました。
環境Visual Studio 2019.NET Framework 4.7.
[C# WPF] ObservableCollectionをListBoxとBindingする

ListBoxへのObservableCollectionのBinding手順をよく忘れるのでまとめ。
ObservableCollectionの場合単純に文字列のコレクションをBindingする場合はこうなります。
[C# WPF] TabControlのSelectionChangedイベントがタブを切り替えなくても呼ばれる

TabControlのSelectionChangedイベントがタブ以外のコントロールを操作した場合にも呼び出されていたので、ちょっと調べました。
検証コード以下のようにTabControlの中にListBoxを持つダイア ...
[C# WPF] StreamGeometryのLineTo()の長さ制限

WPFでStreamGeometryを使って直線を描画していると、ときどき直線が表示されなくなる現象に遭遇しました。
割と大きいスクロールビューに描画をしているところだったので、その辺の問題だろうと思って調べると、どうも.NE ...
[C# WPF] テキストのサイズを算出する

まずは手順から。WPFで文字列のサイズを取得する方法です。
XAML側<Window x:Class="Sample_StringSize.MainWindow" xmlns="" xmlns:x="" xmlns:d=" ....NET Core 3.0でWPFを試してみた

いまさら感は気にせずにまとめます。
インストールまずはVisual Studio 2019 Previewを入れます。
次に.NET Core 3.0 Previewを入れます。
.NET Core ...
[C# WPF] システムメニューが開かれたタイミングでなにかしたい

メニューが開かれたときには設定を解除しないといけない案件がありました。
メインメニューとコンテキストメニューはContextMenuOpendのイベントハンドラを使えば対応できたのですが、システムメニューどうするんだ?というこ ...
[C# WPF] コードビハインドからListBoxの要素を複数選択する

たまに使うと忘れているので書いておきます。
何も考えずにListBox.SelectedItemを更新してしまうと既に選択してあった項目の選択状態も解除されてしまいます。
[C# WPF] ContextMenuのCheckBoxをThreeStateで表示する

ContextMenuに3つの状態を遷移するチェックボックスを付けたくなりました。
標準のMenuItemはIsThreeStateを使用できなかったので、それっぽい動きをするものを自作しました。
CheckBoxと同 ...
[C# WPF] コードビハインドでRelativeSource/Converterを設定する

RelativeSouceとConverterの設定をXamlで書けないときがあって、少し探すのに手間取ったので備忘録。
やりたかったことこのとき実現したかったのは、テンプレートの中で宣言
[C# WPF] StreamGeometryで破線を描画する

StreamGeometryで破線の描画をしたくなったのですが、Penオブジェクトへの設定での破線描画を調べると、Drawing.Penを使用する場合の設定方法ばかり出てきたので、Media.Penを使用する場合のサンプルを残しておき ...