添加项目文件。
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Szmedi.RvKits.InfoManager.EAMTools
|
||||
{
|
||||
/// <summary>
|
||||
/// EAMFacilityCodeWin.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class EAMFacilityCodeWin
|
||||
{
|
||||
public EAMFacilityCodeWin()
|
||||
{
|
||||
DataContext = new EAMFacilityCodeViewModel();
|
||||
InitializeComponent();
|
||||
}
|
||||
private void DataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "IsChecked") e.Cancel = true;
|
||||
if (e.PropertyDescriptor is PropertyDescriptor descriptor)
|
||||
{
|
||||
var readOnly = descriptor.Attributes.OfType<ReadOnlyAttribute>().FirstOrDefault();
|
||||
if (readOnly == null)
|
||||
{
|
||||
e.Column.IsReadOnly = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Column.IsReadOnly = readOnly.IsReadOnly;
|
||||
}
|
||||
var generate = descriptor.Attributes.OfType<DoNotAutoGeneratColumnAttribute>().FirstOrDefault();
|
||||
|
||||
if (generate != null)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
var excelColumnAttribute = descriptor.Attributes.OfType<EPPlus.Core.Extensions.Attributes.ExcelTableColumnAttribute>().FirstOrDefault();
|
||||
if (excelColumnAttribute != null)
|
||||
{
|
||||
e.Column.Header = excelColumnAttribute.ColumnName;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Column.Header = descriptor.DisplayName;
|
||||
}
|
||||
}
|
||||
// if (e.PropertyName == "Name") e.Column.Header = "姓名";硬编码
|
||||
// if (e.PropertyName == "Email") e.Cancel = true;不生成列
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user