packages/MaterialDesignThemes.2.5.1/src/net45/DataGridAssist.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace MaterialDesignThemes.Wpf
{
public static class DataGridAssist
{
private static DataGrid _suppressComboAutoDropDown;
public static readonly DependencyProperty AutoGeneratedCheckBoxStyleProperty = DependencyProperty
.RegisterAttached(
"AutoGeneratedCheckBoxStyle", typeof (Style), typeof (DataGridAssist),
new PropertyMetadata(default(Style), AutoGeneratedCheckBoxStylePropertyChangedCallback));
private static void AutoGeneratedCheckBoxStylePropertyChangedCallback(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
((DataGrid) dependencyObject).AutoGeneratingColumn += (sender, args) =>
{
var dataGridCheckBoxColumn = args.Column as DataGridCheckBoxColumn;
if (dataGridCheckBoxColumn == null) return;
dataGridCheckBoxColumn.ElementStyle = GetAutoGeneratedCheckBoxStyle(dependencyObject);
};
}
public static void SetAutoGeneratedCheckBoxStyle(DependencyObject element, Style value)
{
element.SetValue(AutoGeneratedCheckBoxStyleProperty, value);
}
public static Style GetAutoGeneratedCheckBoxStyle(DependencyObject element)
{
return (Style) element.GetValue(AutoGeneratedCheckBoxStyleProperty);
}
public static readonly DependencyProperty AutoGeneratedEditingCheckBoxStyleProperty = DependencyProperty
.RegisterAttached(
"AutoGeneratedEditingCheckBoxStyle", typeof (Style), typeof (DataGridAssist),
new PropertyMetadata(default(Style), AutoGeneratedEditingCheckBoxStylePropertyChangedCallback));
private static void AutoGeneratedEditingCheckBoxStylePropertyChangedCallback(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
((DataGrid) dependencyObject).AutoGeneratingColumn += (sender, args) =>
{
var dataGridCheckBoxColumn = args.Column as DataGridCheckBoxColumn;
if (dataGridCheckBoxColumn == null) return;
dataGridCheckBoxColumn.EditingElementStyle = GetAutoGeneratedEditingCheckBoxStyle(dependencyObject);
};
}
public static void SetAutoGeneratedEditingCheckBoxStyle(DependencyObject element, Style value)
后面还有 166 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。