如果我在行外单击,如何删除对行的选择。就像下面显示的图像的红色区域一样
相关的xaml显示如下:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<DataGrid x:Name="ClientsList" Grid.Row="0" Grid.Column="0" CanUserAddRows="False"
SelectionMode="Extended" SelectionUnit="FullRow"
ItemsSource="{Binding ClientItems}" LostFocus="ClientsList_LostFocus" Background="Green">
</DataGrid>
<StackPanel Margin="2" Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<Button x:Name="AddButton" Margin="2,0,0,0" Content="+" Height="25" Width="40" Click="AddButton_Click"/>
<Button x:Name="DeleteButton" Margin="2,0,0,0" Content="-" Height="25" Width="40" Click="DeleteButton_Click"/>
</StackPanel>
</Grid>
参考方案
如果您单击了空白区域,则OriginalSource
将成为ScrollViewer
(如果未应用其他样式)。尝试将以下MouseUp
事件处理程序添加到DataGrid
:
private void OnDataGridMouseUp(object o, MouseButtonEventArgs e)
{
if (e.OriginalSource is ScrollViewer)
{
((DataGrid) o).UnselectAll();
}
}
Div单击与单选按钮相同吗? - php有没有一种方法可以使div上的click事件与表单环境中的单选按钮相同?我只希望下面的div提交值,单选按钮很丑代码输出如下:<input id="radio-2011-06-08" value="2011-06-08" type="radio" name="radio_date…
将python scikit学习模型导出到pmml - python我想将python scikit-learn模型导出到PMML。哪个python软件包最合适?我阅读了有关Augustus的内容,但是我无法使用scikit-learn模型找到任何示例。 python大神给出的解决方案 SkLearn2PMML是 JPMML-SkLearn命令行应用程序周围的薄包装。有关受支持的Scikit-Learn Estimator和…
如何使用PHP从动态输入字段捕获数组值? - javascript我正在编写一个在线时间跟踪网页,允许用户将学习时间输入该系统。用户将首先输入名称,然后根据日期输入学习时间。一天中可能会有多个学习时间。以下是我第一页的编码,<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"…
SOAPFaultException部署在Tomcat上时,但在GlassFish中工作正常 - java朋友们,我一直在尝试很多,阅读了很多论坛,但无法理解为什么出现此问题。我使用契约优先方法创建了一个Jax-WS WebService。创建WSDL和XSD,然后使用wsimport工具生成其余工件,为SEI提供实现。将WebService应用程序部署到Eclipse Helios中的GlassFish(Glassfish适配器和Eclipse中安装的插件)。…
提交表单后显示模式对话框 - php提交下载文件后,我有一张表格。我要自动而不是自动下载文件..以显示模态对话框并显示下载链接。<form name="softwareform" id="softwareform" action="../downloadlink.php" method="POST" alig…