当前位置: 首页>>代码示例>>C#>>正文


C# Controls.DataGridColumn类代码示例

本文整理汇总了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;
            }
        }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:60,代码来源:CaseListSort.cs

示例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;
        }
开发者ID:dfr0,项目名称:moon,代码行数:34,代码来源:DataGridColumns.cs

示例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;
 }
开发者ID:MuhammadUsmaann,项目名称:Education-System-Desktop-App,代码行数:28,代码来源:ColumnInformation.cs

示例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;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:DataGridCellEditEndingEventArgs.cs

示例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;
        }
开发者ID:Boontog,项目名称:Virtualization,代码行数:25,代码来源:DataGridHelper.cs

示例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;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:15,代码来源:DataGridPreparingCellForEditEventArgs.cs

示例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);
        }
开发者ID:tom-englert,项目名称:DataGridExtensions,代码行数:8,代码来源:DataGridEventsProvider.cs

示例8: applySortDirection

 private void applySortDirection(DataGrid grid, DataGridColumn col, ListSortDirection listSortDirection)
 {
     foreach (DataGridColumn c in grid.Columns)
     {
         c.SortDirection = null;
     }
     col.SortDirection = listSortDirection;
 }
开发者ID:Erls-Corporation,项目名称:BookHouse,代码行数:8,代码来源:MainWindow.xaml.cs

示例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;
 }
开发者ID:expanz,项目名称:expanz-Microsoft-XAML-SDKs,代码行数:12,代码来源:DataGridColumnEventArgs.cs

示例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();
        }
开发者ID:shinesoleil,项目名称:widgetJquery,代码行数:12,代码来源:XHtmlGenericCell.cs

示例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;
 }
开发者ID:expanz,项目名称:expanz-Microsoft-XAML-SDKs,代码行数:21,代码来源:DataGridBeginningEditEventArgs.cs

示例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;
        }
开发者ID:ahodesuka,项目名称:AniDBmini,代码行数:9,代码来源:MylistModel.cs

示例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;
 }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:9,代码来源:DataGridSettings.cs

示例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);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:10,代码来源:DataGridCellInfo.cs

示例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;
 }
开发者ID:ruisebastiao,项目名称:Elysium-Extra,代码行数:10,代码来源:DataGridColumnInfo.cs


注:本文中的System.Windows.Controls.DataGridColumn类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。