Specify datacontext type on listbox ItemContainer in style

后端 未结 4 1722
野性不改
野性不改 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:24

    As pointed out by @HighCore the solution is to specify d:DataContext attribute from blend SDK, however, it worked only when set on a Style element itsself, not in the property setter:

    
            
    
    

    This removes Resharper's warning and also changes binding Path when property is renaimed on the ViewModel. Cool!

提交回复
热议问题