我们正在使用 Resharper,当然我们想利用 Resharper 的 xaml 智能感知。
我们 View 的数据上下文绑定到CurrentViewmodel
type 的属性ViewModelBase
。在运行时,此属性设置为使用继承自 的视图模型ViewModelBase
。
我已经在 View 模型中添加了这些行来设置正确的类型:
xmlns:vms="clr-namespace:PQS.ViewModel.Report"
d:DataContext="{d:DesignInstance vms:ReportFilterViewModel, IsDesignTimeCreatable=False}"
但 Resharper 仍在继续寻找ViewModelbase
属性。
我还能尝试什么?
更多代码:
设置数据上下文:
<UserControl.DataContext>
<Binding Path="ReportMainViewModel.CurrentVm" Source="{StaticResource Locator}"/>
</UserControl.DataContext>
绑定一些东西(Products 是 ReportFilterViewmodel 上的一个属性,r# 一直在 ViewModelBase 中寻找它):
<ListBox ItemsSource="{Binding Products.View}" Background="White" DisplayMemberPath="Name.ActualTranslation">
</ListBox>