static void TaskDataGridColumnSetReadOnly(DataGridColumn column, string route, PropertyRoute context) { bool isReadOnly = context.PropertyRouteType == PropertyRouteType.FieldOrProperty && context.PropertyInfo.IsReadOnly(); if (isReadOnly && column.NotSet(DataGridColumn.IsReadOnlyProperty)) { column.IsReadOnly = isReadOnly; } }
public static void TaskDataGridColumnSetLabelText(DataGridColumn col, string route, PropertyRoute context) { DependencyProperty labelText = DataGridColumn.HeaderProperty; if (labelText != null && col.NotSet(labelText)) { string text = context.PropertyInfo.NiceName(); UnitAttribute ua = context.PropertyInfo.GetCustomAttribute <UnitAttribute>(); if (ua != null) { text += " (" + ua.UnitName + ")"; } col.SetValue(labelText, text); } }