我有UserControl
和DataGrid
,并且像这样添加了UserControl
:
<local:TouchScrollDataGrid DataContext="{Binding ArticlesProposalsGeneral}" />
ArticlesProposalsGeneral
是一个带有字段的类:
public PayloadItem SelectedItem
{
get => _selectedItem;
set { _selectedItem = value; RaisePropertyChanged(nameof(SelectedItem)); }
}
public List<PayloadItem> FullList
{
get => _fullList;
set
{
_fullList = value;
RaisePropertyChanged(nameof(FullList));
RaisePropertyChanged(nameof(Window));
}
}
DataGrid
具有以下设置:
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
IsSynchronizedWithCurrentItem="True"
现在,当我存储所选商品的ID并这样做时:
ArticlesProposalsGeneral.FullList = DbCache.ArticlesProposalsGeneral;
然后在FullList
上找到此项目并设置SelectedItem
,我无法使corect项突出显示-它接缝了该项目,因为当我使用控件中的其他按钮时,它会指向正确的项目。但是突出显示始终是第一项。