本文整理汇总了C#中System.Windows.Controls.DataGridColumn类的典型用法代码示例。如果您正苦于以下问题:C# DataGridColumn类的具体用法?C# DataGridColumn怎么用?C# DataGridColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridColumn类属于System.Windows.Controls命名空间,在下文中一共展示了DataGridColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaseListSort
public CaseListSort(ListSortDirection direction, DataGridColumn column)
{
int dir = (direction == ListSortDirection.Ascending) ? 1: -1;
string path = BindingOperations.GetBindingExpression(column, DataGridColumn.HeaderProperty).ParentBinding.Path.Path;
switch (path)
{
case "CaseId":
myComparer = (a, b) => { return a.CaseId.CompareTo(b.CaseId) * dir; };
break;
case "AnalystComment":
myComparer = (a, b) => { return a.AnalystComment.CompareTo(b.AnalystComment) * dir;};
break;
case "ObjectId":
myComparer = (a, b) => { return a.ObjectId.CompareTo(b.ObjectId) * dir;};
break;
case "FlightNumber":
myComparer = (a, b) => { return a.FlightNumber.CompareTo(b.FlightNumber) * dir; };
break;
case "Analyst":
myComparer = (a, b) => { return a.Analyst.CompareTo(b.Analyst) * dir; };
break;
case "CaseDirectory":
myComparer = (a, b) => { return a.CaseDirectory.CompareTo(b.CaseDirectory) * dir; };
break;
case "ReferenceImage":
myComparer = (a, b) => { return a.ReferenceImage.CompareTo(b.ReferenceImage) * dir; };
break;
case "Result":
myComparer = (a, b) => { return a.Result.CompareTo(b.Result) * dir; };
break;
case "UpdateTime":
myComparer = (a, b) => { return a.UpdateTime.CompareTo(b.UpdateTime) * dir; };
break;
case "CreateTime":
myComparer = (a, b) => { return a.CreateTime.CompareTo(b.CreateTime) * dir; };
break;
case "Archived":
myComparer = (a, b) => { return a.Archived.CompareTo(b.Archived) * dir; };
break;
case "AnalysisTime":
myComparer = (a, b) => { return a.AnalysisTime.CompareTo(b.AnalysisTime) * dir; };
break;
default:
myComparer = (a, b) => { return 0; };
break;
}
}
示例2: GetColumnReadOnlyState
internal bool GetColumnReadOnlyState(DataGridColumn dataGridColumn, bool isReadOnly)
{
Debug.Assert(dataGridColumn != null);
DataGridBoundColumn dataGridBoundColumn = dataGridColumn as DataGridBoundColumn;
if (dataGridBoundColumn != null && dataGridBoundColumn.Binding != null)
{
string path = null;
if (dataGridBoundColumn.Binding.Path != null)
{
path = dataGridBoundColumn.Binding.Path.Path;
}
if (!string.IsNullOrEmpty(path))
{
if (dataGridBoundColumn.IsAutoGenerated)
{
Type type = null;
if (DataConnection.DataType != null)
{
type = DataConnection.DataType.GetNestedPropertyType(path);
}
if (type != null && !DataGridDataConnection.CanEdit(type))
{
return true;
}
}
return this.DataConnection.GetPropertyIsReadOnly(path) || isReadOnly;
}
}
return isReadOnly;
}
示例3: ColumnInformation
public ColumnInformation(DataGridColumn column)
{
Header = column.Header;
if (!(column is DataGridTemplateColumn))
{
try
{
if (column is DataGridComboBoxColumn)
PropertyPath = column.SortMemberPath;
else
PropertyPath = ((Binding)((DataGridBoundColumn)column).Binding).Path.Path;
}
catch
{
PropertyPath = string.Empty;
}
}
else
{
PropertyPath = column.SortMemberPath;
}
WidthValue = column.Width.DisplayValue;
WidthType = column.Width.UnitType;
SortDirection = column.SortDirection;
DisplayIndex = column.DisplayIndex;
SortMemberPath = column.SortMemberPath;
IsVisible = column.Visibility == Visibility.Visible;
}
示例4: DataGridCellEditEndingEventArgs
/// <summary>
/// Instantiates a new instance of this class.
/// </summary>
/// <param name="column">The column of the cell that is about to exit edit mode.</param>
/// <param name="row">The row container of the cell container that is about to exit edit mode.</param>
/// <param name="editingElement">The editing element within the cell.</param>
/// <param name="editingUnit">The editing unit that is about to leave edit mode.</param>
public DataGridCellEditEndingEventArgs(DataGridColumn column, DataGridRow row, FrameworkElement editingElement, DataGridEditAction editAction)
{
_dataGridColumn = column;
_dataGridRow = row;
_editingElement = editingElement;
_editAction = editAction;
}
示例5: GetSortMemberPath
public static string GetSortMemberPath(DataGridColumn column)
{
string sortPropertyName = column.SortMemberPath;
if (string.IsNullOrEmpty(sortPropertyName))
{
var boundColumn = column as DataGridBoundColumn;
if (boundColumn != null)
{
var binding = boundColumn.Binding as Binding;
if (binding != null)
{
if (!string.IsNullOrEmpty(binding.XPath))
{
sortPropertyName = binding.XPath;
}
else if (binding.Path != null)
{
sortPropertyName = binding.Path.Path;
}
}
}
}
return sortPropertyName;
}
示例6: DataGridPreparingCellForEditEventArgs
/// <summary>
/// Constructs a new instance of these event arguments.
/// </summary>
/// <param name="column">The column of the cell that just entered edit mode.</param>
/// <param name="row">The row container that contains the cell container that just entered edit mode.</param>
/// <param name="editingEventArgs">The event arguments, if any, that led to the cell being placed in edit mode.</param>
/// <param name="cell">The cell container that just entered edit mode.</param>
/// <param name="editingElement">The editing element within the cell container.</param>
public DataGridPreparingCellForEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs, FrameworkElement editingElement)
{
_dataGridColumn = column;
_dataGridRow = row;
_editingEventArgs = editingEventArgs;
_editingElement = editingElement;
}
示例7: AddEventHandlers
private void AddEventHandlers(DataGridColumn column)
{
Contract.Requires(column != null);
VisibilityPropertyDescriptor.AddValueChanged(column, DataGridColumnVisibility_Changed);
ActualWidthPropertyDescriptor.AddValueChanged(column, DataGridColumnActualWidth_Changed);
DisplayIndexPropertyDescriptor.AddValueChanged(column, DataGridColumnDisplayIndex_Changed);
}
示例8: applySortDirection
private void applySortDirection(DataGrid grid, DataGridColumn col, ListSortDirection listSortDirection)
{
foreach (DataGridColumn c in grid.Columns)
{
c.SortDirection = null;
}
col.SortDirection = listSortDirection;
}
示例9: DataGridColumnEventArgs
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Windows.Controls.Data.DataGridColumnEventArgs" /> class.
/// </summary>
/// <param name="column">The column that the event occurs for.</param>
public DataGridColumnEventArgs(DataGridColumn column)
{
if (column == null)
{
throw new ArgumentNullException("column");
}
this.Column = column;
}
示例10: XHtmlGenericCell
// !!!!!!!!!DataGridColumn
/// <summary>
/// Initializes a new instance of the XHtmlTextBoxCell class.
/// </summary>
public XHtmlGenericCell(DataGridColumn column)
{
Presentation = new XHtmlPresentationCell();
// this.column = column as XHtmlTextBoxColumn;
SetStyle();
}
示例11: DataGridBeginningEditEventArgs
/// <summary>
/// Initializes a new instance of the
/// <see cref="T:System.Windows.Controls.Data.DataGridBeginningEditEventArgs" /> class.
/// </summary>
/// <param name="column">
/// The column that contains the cell to be edited.
/// </param>
/// <param name="row">
/// The row that contains the cell to be edited.
/// </param>
/// <param name="editingEventArgs">
/// Information about the user gesture that caused the cell to enter edit mode.
/// </param>
public DataGridBeginningEditEventArgs(DataGridColumn column,
DataGridRow row,
RoutedEventArgs editingEventArgs)
{
this.Column = column;
this.Row = row;
this.EditingEventArgs = editingEventArgs;
}
示例12: Sort
public ITreeModel Sort(ListSortDirection lsd, DataGridColumn column)
{
MylistModel model = new MylistModel(m_myList);
model.m_currentSort = new SortDescription { direction = lsd, column = column };
model.Root.Sort(new MylistSort(lsd, column));
return model;
}
示例13: DataGridColumnInfo
public DataGridColumnInfo(DataGridColumn column)
{
IsVisible = column.Visibility == System.Windows.Visibility.Visible;
DisplayIndex = column.DisplayIndex;
if (column.Width.IsAuto)
WidthValue = null;
else
WidthValue = column.Width.DisplayValue;
}
示例14: DataGridCellInfo
internal DataGridCellInfo(object item, DataGridColumn column, DataGrid owner)
{
Debug.Assert(item != null, "item should not be null.");
Debug.Assert(column != null, "column should not be null.");
Debug.Assert(owner != null, "owner should not be null.");
_info = owner.NewItemInfo(item);
_column = column;
_owner = new WeakReference(owner);
}
示例15: DataGridColumnInfo
public DataGridColumnInfo(DataGridColumn column)
: this()
{
this.DisplayIndex = column.DisplayIndex;
this.Name = AutomationProperties.GetName(column);
this.SortDirection = column.SortDirection;
this.Visibility = column.Visibility;
this.WidthType = column.Width.UnitType;
this.WidthValue = column.Width.DisplayValue;
}