![](/img/trans.png)
[英]how can I get the WPF DataGrid's Row CheckBox's Checked Event in code behind
[英]How do I dynamically turn on/off tooltips for a WPF DataGrid in the code behind?
有没有一种方法可以在后面的C#代码中为WPF DataGrid动态打开/关闭工具提示?
谢谢。
您可以通过编程方式添加/删除Style
:
Style style;
private void Button_AddOrRemove_Click(object sender, RoutedEventArgs e)
{
if (dataGrid1.Resources.Count > 0)
{
style = dataGrid1.Resources[typeof(DataGridCell)] as Style;
dataGrid1.Resources.Clear();
}
else if (style != null)
{
dataGrid1.Resources.Add(typeof(DataGridCell), style);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.