Xceed DataGrid for WPF:复选框需要单击3次才能更改

Xceed DataGrid for WPF:复选框需要单击3次才能更改,wpf,xaml,datagrid,xceed,xceed-datagrid,Wpf,Xaml,Datagrid,Xceed,Xceed Datagrid,我制作了一个非常基本的DataGrid来测试它,但我立即遇到了这个问题,在最初的两次点击中,点击复选框并没有任何作用。看起来它需要点击一次来关闭它所打开的任何东西,再点击一次来聚焦,然后它才能用第三次点击来检查它 这是我正在使用的DataGrid,顺便说一句() XAML: “SampleDataSource1”只是自动生成的,但在这里它仍然是: <SampleDataSource1:SampleDataSource1 xmlns:SampleDataSource1="clr-nam

我制作了一个非常基本的DataGrid来测试它,但我立即遇到了这个问题,在最初的两次点击中,点击复选框并没有任何作用。看起来它需要点击一次来关闭它所打开的任何东西,再点击一次来聚焦,然后它才能用第三次点击来检查它

这是我正在使用的DataGrid,顺便说一句()

XAML:


“SampleDataSource1”只是自动生成的,但在这里它仍然是:

<SampleDataSource1:SampleDataSource1 xmlns:SampleDataSource1="clr-namespace:Expression.Blend.SampleData.SampleDataSource1">
<SampleDataSource1:SampleDataSource1.Collection>
    <SampleDataSource1:Item Property1="Cras aenean" Property2="True"/>
    <SampleDataSource1:Item Property1="Class mauris aliquam" Property2="False"/>
    <SampleDataSource1:Item Property1="Maecenas integer duis curae" Property2="True"/>
    <SampleDataSource1:Item Property1="Praesent nullam nunc" Property2="False"/>
    <SampleDataSource1:Item Property1="Nam quisque" Property2="True"/>
    <SampleDataSource1:Item Property1="Sed accumsan" Property2="False"/>
    <SampleDataSource1:Item Property1="Aptent vivamus aliquam aliquet" Property2="True"/>
    <SampleDataSource1:Item Property1="Blandit donec dis" Property2="False"/>
    <SampleDataSource1:Item Property1="Amet commodo" Property2="True"/>
    <SampleDataSource1:Item Property1="Ante conubia" Property2="False"/>
</SampleDataSource1:SampleDataSource1.Collection>

在数据网格中添加以下内容(在xaml中):

在后面的代码中添加以下内容:

private void DataGrid_GotFocus(object sender, RoutedEventArgs e)
{
    // Lookup for the source to be DataGridCell
    if (e.OriginalSource.GetType() == typeof(DataGridCell))
    {
        // Starts the Edit on the row;
        DataGrid grd = (DataGrid)sender;
        grd.BeginEdit(e);
    }
}
在dataGrid上添加以下内容(在xaml中):

在后面的代码中添加以下内容:

private void DataGrid_GotFocus(object sender, RoutedEventArgs e)
{
    // Lookup for the source to be DataGridCell
    if (e.OriginalSource.GetType() == typeof(DataGridCell))
    {
        // Starts the Edit on the row;
        DataGrid grd = (DataGrid)sender;
        grd.BeginEdit(e);
    }
}

所以,如果你幸运的话,你会在你的设计窗口中看到一个巨大的亮点,上面有一个按钮,上面写着:“显示配置窗口”(在使用它之后似乎永远消失)。因此,我生成了一些XAML来解决此问题:

    <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource cvsSongs}}"
                          NavigationBehavior="RowOrCell" 
                          CellEditorDisplayConditions="RowIsBeingEdited, MouseOverCell, 
                          MouseOverRow, RowIsCurrent, CellIsCurrent" 
                          EditTriggers="BeginEditCommand, ClickOnCurrentCell, SingleClick, 
                          CellIsCurrent, ActivationGesture, RowIsCurrent"/>

如果您知道如何使该窗口再次出现,请随时发表评论

配置窗口信息:


还有其他一些人有配置窗口问题。可能适合您:

因此,如果您幸运的话,您会在设计窗口中看到一个巨大的亮点,上面有一个按钮,上面写着:“显示配置窗口”(在使用它之后,它似乎会永远消失)。因此,我生成了一些XAML来解决此问题:

    <xcdg:DataGridControl ItemsSource="{Binding Source={StaticResource cvsSongs}}"
                          NavigationBehavior="RowOrCell" 
                          CellEditorDisplayConditions="RowIsBeingEdited, MouseOverCell, 
                          MouseOverRow, RowIsCurrent, CellIsCurrent" 
                          EditTriggers="BeginEditCommand, ClickOnCurrentCell, SingleClick, 
                          CellIsCurrent, ActivationGesture, RowIsCurrent"/>

如果您知道如何使该窗口再次出现,请随时发表评论

配置窗口信息:


还有其他一些人有配置窗口问题。可能对你有用:

谢谢你的快速回答,但它不起作用?没有区别,所以我感觉它没有达到功能或其他方面。智能感知识别它和一切。没有错误。我有点傻,我会错过什么吗?我也有同样的问题,但在数据网格中有组合框,我就是这样解决的,尽管它可以工作:)你有没有尝试在DataGrid_GotFocus方法中设置断点,只是为了看看它是否被调用?是的,它被调用了,但在交互中没有区别。。奇怪的感谢您的尝试,可能有助于找到解决方案:)。我只是想知道DataGridCell是否适合这种情况谢谢您的快速回答,但它不起作用?没有区别,所以我感觉它没有达到功能或其他方面。智能感知识别它和一切。没有错误。我有点傻,我会错过什么吗?我也有同样的问题,但在数据网格中有组合框,我就是这样解决的,尽管它可以工作:)你有没有尝试在DataGrid_GotFocus方法中设置断点,只是为了看看它是否被调用?是的,它被调用了,但在交互中没有区别。。奇怪的感谢您的尝试,可能有助于找到解决方案:)。我只是想知道在这种情况下DataGridCell是否是正确的类型