我有一个非常简单的 XamDataGrid,其中包含不想使用箭头键导航的测试数据。
XAML:
<dataPresenter:XamDataGrid x:Name="testGrid" Grid.Row="1" Grid.Column="3" DataSource="{Binding Tests}" />
视图模型:
private ObservableCollection<string> tests = new ObservableCollection<string> { "one", "two", "three", "four", "five" };
public ObservableCollection<string> Tests
{
get => tests;
set
{
tests = value;
RaisePropertyChanged(nameof(Tests));
}
}
我做错了什么?
尝试在激活窗口时以编程方式将焦点设置在
XamDataGrid
上:
public MainWindow()
{
InitializeComponent();
testGrid.Focus();
}