Specify datacontext type on listbox ItemContainer in style

后端 未结 4 1723
野性不改
野性不改 2020-12-17 15:47

In a ListBox I have a ItemContainer\'s IsSelected property bound to my ViewModel\'s IsSelected property using

4条回答
  •  一整个雨季
    2020-12-17 16:20

    Specifying d:DataContext="{d:DesignInstance nmspc:Clz}" with other attributes of Style tag didn't help me: R# / IntelliSense really stopped highlighting properties I was binding to but the designer also showed me an error message instead of the view.

    The trick I found out is to specify inside the Style tag. And it appeared to be so universal that it answers another question, about using interfaces as d:DataContext.

    Here is my answer to that question with a small example: https://stackoverflow.com/a/46637478/5598194

提交回复
热议问题