0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【UWP】SelectedItemのバインディングが反映されない時の対処法

0
Posted at

この記事で説明する対処法はSelectorクラス派生のコントロールに共通して当てはまります

x:Bind の場合は Mode=OneWay or Mode=TwoWay を指定する

{Binding}を利用した場合はデフォルトでMode=OneWayですが、{x:Bind}Mode=OneTimeがデフォルトです。

Itemがclassの場合、IEquatable を実装する

アイテムの同値を判定するのにReferenceEqualsが利用されますが、IEquatableが実装されている場合はそちらが優先されます。

同じインスタンスのつもりでSelectedItemに指定したアイテムが別インスタンスとなる可能性がある場合は、IEquatableを実装することで意図通りバインディングされます。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?