How can i specify a designer datacontext for a style, so Resharper finds my properties?

后端 未结 2 1473
半阙折子戏
半阙折子戏 2021-01-31 04:21

I often bind the IsExpanded and IsSelected properties of a TreeViewItem to my viewmodel. This for example makes it possible to make an item pre-expanded when the tree is loaded

2条回答
  •  一生所求
    2021-01-31 04:53

    @lhildebrandt's answer is generally right, but in my case this solution produces errors that totally disable displaying the view in designer. Specifying inside

    In this way d:DataContext can also be specified for controls, and we can provide it interfaces, nested classes and even generics without any errors: https://stackoverflow.com/a/46637478/5598194

提交回复
热议问题