示例#1
0
        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;
        }
 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;
 }
示例#3
0
        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;
            }
        }
        internal void RaiseAutomationInvokeEvents(DataGridEditingUnit editingUnit, DataGridColumn column, DataGridRow row)
        {
            switch (editingUnit)
            {
            case DataGridEditingUnit.Cell:
            {
                DataGridCell   cell = row.Cells[column.Index];
                AutomationPeer peer = FromElement(cell);
                if (peer != null)
                {
                    peer.InvalidatePeer();
                }
                else
                {
                    peer = CreatePeerForElement(cell);
                }

                if (peer != null)
                {
                    peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                }
                break;
            }

            case DataGridEditingUnit.Row:
            {
                DataGridItemAutomationPeer peer = GetOrCreateItemPeer(row.DataContext);
                peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                break;
            }
            }
        }
 /// <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;
 } 
 /// <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;
 }
示例#7
0
        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;
        }
        private void AddEventHandlers(DataGridColumn column)
        {
            Contract.Requires(column != null);

            VisibilityPropertyDescriptor.AddValueChanged(column, DataGridColumnVisibility_Changed);
            ActualWidthPropertyDescriptor.AddValueChanged(column, DataGridColumnActualWidth_Changed);
            DisplayIndexPropertyDescriptor.AddValueChanged(column, DataGridColumnDisplayIndex_Changed);
        }
示例#9
0
 /// <summary>
 /// 列是否为模板列
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="column"></param>
 /// <returns></returns>
 public static bool IsTemplate(this DataGrid grid, System.Windows.Controls.DataGridColumn column)
 {
     if (column == null)
     {
         return(false);
     }
     return(column is System.Windows.Controls.DataGridTemplateColumn);
 }
示例#10
0
 /// <summary>
 /// 列是否存在单元格模板
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="column"></param>
 /// <returns></returns>
 public static bool IsCellTemplate(this DataGrid grid, System.Windows.Controls.DataGridColumn column)
 {
     if (grid.IsTemplate(column))
     {
         return((column as System.Windows.Controls.DataGridTemplateColumn).CellTemplate != null);
     }
     return(false);
 }
 /// <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;
 }
        // !!!!!!!!!DataGridColumn
        /// <summary>
        /// Initializes a new instance of the XHtmlTextBoxCell class.
        /// </summary>
        public XHtmlGenericCell(DataGridColumn column)
        {
            Presentation = new XHtmlPresentationCell();

            //			this.column = column as XHtmlTextBoxColumn;

            SetStyle();
        }
 private void applySortDirection(DataGrid grid, DataGridColumn col, ListSortDirection listSortDirection)
 {
     foreach (DataGridColumn c in grid.Columns)
     {
         c.SortDirection = null;
     }
     col.SortDirection = listSortDirection;
 }
 /// <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;
 }
示例#15
0
 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;
 }
示例#16
0
        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;
        }
示例#17
0
        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);
        }
示例#18
0
        internal DataGridCellInfo(ItemsControl.ItemInfo info, DataGridColumn column, DataGrid owner)
        {
            Debug.Assert(info != 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 = info;
            _column = column;
            _owner = new WeakReference(owner);
        }
 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;
 }
 public void DoDataGridColumn(ExDataGrid _dg, int _waitTime, DataGridColumn _dataGridColumn)
 {
     BackgroundWorker bw = new BackgroundWorker();
     dg = _dg;
     waitTime = _waitTime;
     dataGridColumn = _dataGridColumn;
     bw.DoWork -= new DoWorkEventHandler(bw_DoDataGridColumn);
     bw.DoWork += new DoWorkEventHandler(bw_DoDataGridColumn);
     bw.RunWorkerAsync();
 }
示例#21
0
        /// <summary>
        ///     Identifies a cell at the column within the row for the specified item.
        /// </summary>
        /// <param name="item">The item who's row contains the cell.</param>
        /// <param name="column">The column of the cell within the row.</param>
        /// <remarks>
        ///     This constructor will not tie the DataGridCellInfo to any particular
        ///     DataGrid.
        /// </remarks>
        public DataGridCellInfo(object item, DataGridColumn column)
        {
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            _info = new ItemsControl.ItemInfo(item);
            _column = column;
            _owner = null;
        }
示例#22
0
        /// <summary>
        ///     Identifies a cell at the column within the row for the specified item. 
        /// </summary>
        /// <param name="item">The item who's row contains the cell.</param>
        /// <param name="column">The column of the cell within the row.</param>
        /// <remarks> 
        ///     This constructor will not tie the DataGridCellInfo to any particular
        ///     DataGrid. 
        /// </remarks> 
        public DataGridCellInfo(object item, DataGridColumn column)
        { 
            if (column == null)
            {
                throw new ArgumentNullException("column");
            } 

            _item = item; 
            _column = column; 
            _owner = null;
        } 
 internal DataGridAutoGeneratingColumnEventArgs(
     DataGridColumn column,
     string propertyName, 
     Type propertyType,
     object propertyDescriptor) 
 { 
     _column = column;
     _propertyName = propertyName; 
     _propertyType = propertyType;
     PropertyDescriptor = propertyDescriptor;
 }
示例#24
0
 public void Apply(DataGridColumn column, int gridColumnCount)
 {
     column.Visibility = IsVisible ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
     var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
     column.DisplayIndex = (DisplayIndex <= maxIndex) ? DisplayIndex : maxIndex;
     if (column.CanUserResize)
     {
         if (WidthValue.HasValue)
             column.Width = new DataGridLength(WidthValue.Value);
     }
 }
示例#25
0
		public static void ApplyColumnStyle(DataGridColumn columnTemplate, ColumnHeader columnHeader)
		{
			columnTemplate.Header = columnHeader;

			if (!columnHeader.IsNumeric)
			{
				return;
			}

			columnTemplate.HeaderStyle = (Style)Application.Current.Resources["HeaderStyleRightAlign"];
			columnTemplate.CellStyle = (Style)Application.Current.Resources["CellStyleRightAlign"];
		}
        public void Apply(DataGridColumn column, int gridColumnCount)
        {
            if (column.DisplayIndex != this.DisplayIndex)
            {
                var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
                column.DisplayIndex = (this.DisplayIndex <= maxIndex) ? this.DisplayIndex : maxIndex;
            }

            column.SortDirection = this.SortDirection;
            column.Visibility = this.Visibility;
            column.Width = new DataGridLength(this.WidthValue, this.WidthType);
        }
示例#27
0
        /// <summary>
        /// Constructor for Error user control class.
        /// Creates data source with page size 18.
        /// </summary>
        public ErrorLogUserControl()
        {
            InitializeComponent();
            m_dataContext = new ErrorLogViewModel(18);
            m_dataContext.PropertyChanged += ViewModel_PropertyChanged;
            this.DataContext = m_dataContext;

            m_sortColumn = DataGridList.Columns.Single(column => (string)column.Header == "Sl No.");
            m_sortMemberPath = "ID";
            m_sortDirection = ListSortDirection.Descending;
            m_dataContext.SortData(m_sortMemberPath, m_sortDirection);
        }
 public void AffMas_Colonne(MenuItem menuItem, DataGridColumn dataGridColumn)
 {
     if (menuItem.IsChecked == true)
     {
         dataGridColumn.Visibility = Visibility.Collapsed;
         menuItem.IsChecked = false;
     }
     else
     {
         dataGridColumn.Visibility = Visibility.Visible;
         menuItem.IsChecked = true;
     }
 }
        /// <summary>
        /// Called when the Header property on a Column changes.  Causes us to fire a CollectionChanged event to specify that an item has been replaced. 
        /// </summary>
        /// <param name="column"></param>
        internal void NotifyHeaderPropertyChanged(DataGridColumn column, DependencyPropertyChangedEventArgs e)
        { 
            Debug.Assert(e.Property == DataGridColumn.HeaderProperty, "We only want to know about the header property changing");
            Debug.Assert(_columns.Contains(column)); 
 
            NotifyCollectionChangedEventArgs args = new NotifyCollectionChangedEventArgs(
                NotifyCollectionChangedAction.Replace, 
                e.NewValue,
                e.OldValue,
                _columns.IndexOf(column));
 
            FireCollectionChanged(args);
        } 
示例#30
0
        private void DataGrid_Sorting(object sender, DataGridSortingEventArgs e)
        {
            if (e.Column.SortMemberPath != m_sortMemberPath)
                m_sortDirection = ListSortDirection.Ascending;
            else if (m_sortDirection == ListSortDirection.Ascending)
                m_sortDirection = ListSortDirection.Descending;
            else
                m_sortDirection = ListSortDirection.Ascending;

            m_sortColumn = e.Column;
            m_sortMemberPath = e.Column.SortMemberPath;
            m_dataContext.SortData(m_sortMemberPath, m_sortDirection);
        }
示例#31
0
        public void GenerateDataGridColumn(GridColumnDef column)
        {
            System.Windows.Controls.DataGridColumn col = null;

            switch (column.Type)
            {
            case ColumnType.Text:
                col = new DataGridTextColumn();
                break;

            case ColumnType.Int:
            case ColumnType.Currency:
                col = new DataGridTextColumn();
                break;

            case ColumnType.Check:
                col = new DataGridCheckBoxColumn();
                break;

            case ColumnType.Combo:
                col = new DataGridComboBoxColumn();
                break;

            case ColumnType.Template:        //Template
                col = new DataGridTemplateColumn();
                //((DataGridTemplateColumn)col).CellTemplate = dataTemplate as DataTemplate;
                break;
            }

            if (col != null)
            {
                Binding binding = null;
                if (!String.IsNullOrEmpty(column.Path))
                {
                    binding = new Binding(column.Path);
                }
                if (!String.IsNullOrEmpty(column.Header))
                {
                    col.Header = column.Header;
                }

                col.Width = column.Width;

                if (col is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)col).Binding = binding;
                }
                this.AssociatedObject.Columns.Add(col);
            }
        }
        /// <summary> 
        /// AutomationPeer for an item in a DataGrid
        /// </summary> 
        public DataGridCellItemAutomationPeer(object item, DataGridColumn dataGridColumn) : base() 
        {
            if (item == null) 
            {
                throw new ArgumentNullException("item");
            }
 
            if (dataGridColumn == null)
            { 
                throw new ArgumentNullException("dataGridColumn"); 
            }
 
            _item = item;
            _column = dataGridColumn;
        }
示例#33
0
        // Get the current sort column from XAML or sort using the first column of the Grid.
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            // The current sorted column must be specified in XAML.
            _currentSortColumn = Columns.FirstOrDefault(c => c.SortDirection.HasValue);

            // if not, then take the first column of the grid and set the sort direction to ascending
            if (_currentSortColumn == null)
            {
                _currentSortColumn = Columns.First();
                _currentSortColumn.SortDirection = ListSortDirection.Ascending;
            }

            _currentSortDirection = _currentSortColumn.SortDirection;
        }
 public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions)
 {
     column.Width = new DataGridLength(WidthValue, WidthType);
     column.SortDirection = SortDirection;
     if (SortDirection != null)
     {
         sortDescriptions.Add(new SortDescription(PropertyPath, SortDirection.Value));
     }
     if (column.DisplayIndex != DisplayIndex)
     {
         var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
         column.DisplayIndex = (DisplayIndex <= maxIndex) ? DisplayIndex : maxIndex;
     }
     column.Visibility = IsVisible ? Visibility.Visible : Visibility.Collapsed;
     column.SortMemberPath = SortMemberPath;
 }
 internal DataGridAutoGeneratingColumnEventArgs(DataGridColumn column, ItemPropertyInfo itemPropertyInfo) :
     this(column, itemPropertyInfo.Name, itemPropertyInfo.PropertyType, itemPropertyInfo.Descriptor)
 {
 }
 /// <summary>
 ///     Instantiates a new instance of this class.
 /// </summary>
 /// <param name="column">The column of the cell that is about to enter edit mode.</param>
 /// <param name="row">The row container of the cell container that is about to enter edit mode.</param>
 /// <param name="editingEventArgs">The event arguments, if any, that led to the cell entering edit mode.</param>
 public DataGridBeginningEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs)
 {
     _dataGridColumn   = column;
     _dataGridRow      = row;
     _editingEventArgs = editingEventArgs;
 }
示例#37
0
        public void CellEdited(int row, swc.DataGridColumn dataGridColumn, object dataItem)
        {
            var gridColumn = Widget.Columns[dataGridColumn.DisplayIndex];

            Callback.OnCellEdited(Widget, new GridViewCellEventArgs(gridColumn, row, dataGridColumn.DisplayIndex, dataItem));
        }
 /// <summary>Initializes a new instance of the <see cref="T:System.Windows.Controls.DataGridColumnReorderingEventArgs" /> class.</summary>
 /// <param name="dataGridColumn">The column that is being moved.</param>
 // Token: 0x0600488C RID: 18572 RVA: 0x00149DCE File Offset: 0x00147FCE
 public DataGridColumnReorderingEventArgs(DataGridColumn dataGridColumn) : base(dataGridColumn)
 {
 }
 // Token: 0x06004728 RID: 18216 RVA: 0x00142617 File Offset: 0x00140817
 internal DataGridCellInfo(ItemsControl.ItemInfo info, DataGridColumn column, DataGrid owner)
 {
     this._info   = info;
     this._column = column;
     this._owner  = new WeakReference(owner);
 }
示例#40
0
 protected virtual new void OnColumnChanged(DataGridColumn oldColumn, DataGridColumn newColumn)
 {
 }
示例#41
0
 /// <summary>
 /// Creates a new DataGridClipboardCellValue structure containing information about DataGrid cell
 /// </summary>
 /// <param name="row">DataGrid row item containing the cell</param>
 /// <param name="column">DataGridColumn containing the cell</param>
 /// <param name="value">DataGrid cell value</param>
 public DataGridClipboardCellContent(object item, DataGridColumn column, object content)
 {
     _item    = item;
     _column  = column;
     _content = content;
 }
示例#42
0
 public WpfCellEventArgs(Grid grid, CustomCell cell, int row, swc.DataGridColumn column, object item, CellStates cellState, Control control = null)
     : base(grid, cell, row, -1, item, cellState, control)
 {
     _gridColumn = column;
 }
 /// <summary>
 /// Public constructor
 /// </summary>
 /// <param name="propertyName"></param>
 /// <param name="propertyType"></param>
 /// <param name="column"></param>
 public DataGridAutoGeneratingColumnEventArgs(string propertyName, Type propertyType, DataGridColumn column) :
     this(column, propertyName, propertyType, null)
 {
 }
示例#44
0
 public DataGridSortingEventArgs(DataGridColumn column)
     : base(column)
 {
 }
示例#45
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Windows.Controls.Data.DataGridColumnReorderingEventArgs" /> class.
 /// </summary>
 /// <param name="dataGridColumn"></param>
 public DataGridColumnReorderingEventArgs(DataGridColumn dataGridColumn)
 {
     this.Column = dataGridColumn;
 }
示例#46
0
 /// <summary>
 /// 是下一个单元格编辑
 /// </summary>
 /// <param name="grid"></param>
 public static void NextCellToEdit(this DataGrid grid, System.Windows.Controls.DataGridColumn column, object item)
 {
     grid.CurrentColumn = column;
     grid.SelectedItem  = item;
     grid.BeginEdit();
 }
 /// <summary>
 /// Instantiates a new instance of this class.
 /// </summary>
 /// <param name="column">The column of the cell that has just exited edit mode.</param>
 /// <param name="row">The row container of the cell container that has just exited edit mode.</param>
 /// <param name="editAction">The editing action that has been taken.</param>
 public DataGridCellEditEndedEventArgs(DataGridColumn column, DataGridRow row, DataGridEditAction editAction)
 {
     this.Column     = column;
     this.Row        = row;
     this.EditAction = editAction;
 }
 public DataGridCellClipboardEventArgs(Object item, DataGridColumn column, Object content)
 {
 }
 public void ScrollIntoView(Object item, DataGridColumn column)
 {
 }
        // Token: 0x06004884 RID: 18564 RVA: 0x00149BC4 File Offset: 0x00147DC4
        internal void NotifyHeaderPropertyChanged(DataGridColumn column, DependencyPropertyChangedEventArgs e)
        {
            NotifyCollectionChangedEventArgs args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, e.NewValue, e.OldValue, this._columns.IndexOf(column));

            this.FireCollectionChanged(args);
        }
        private void dgvAuxTools_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                int columnDisplayIndex = dgvAuxTools.CurrentCell.Column.DisplayIndex;

                //if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift))  //original
                if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) || e.Key == Key.Left)
                {
                    //new
                    if (e.Key == Key.Left)
                    {
                        try
                        {
                            System.Windows.Controls.DataGridCellInfo dgt = dgvToolSchedule.CurrentCell;
                            var cellContent = (TextBox)dgt.Column.GetCellContent(dgt.Item);
                            //cellContent.SelectionLength
                            if (cellContent != null)
                            {
                                if (cellContent.SelectionLength != cellContent.Text.Length)
                                {
                                    return;
                                }
                                //new by me

                                //    TextBox
                                //end new by me
                            }
                        }
                        catch (Exception ex)
                        {
                            return;
                        }
                    }
                    //end new
                    e.Handled          = true;
                    columnDisplayIndex = dgvAuxTools.CurrentCell.Column.DisplayIndex;
                    if (columnDisplayIndex == 0)
                    {
                        dgvAuxTools.SelectedIndex = dgvAuxTools.SelectedIndex - 1;
                        columnDisplayIndex        = dgvAuxTools.Columns.Count - 1;
                    }
                    else
                    {
                        if (columnDisplayIndex == 1)
                        {
                            columnDisplayIndex = 0;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex - 1;
                        }
                    }
                    System.Windows.Controls.DataGridColumn nextColumn = dgvAuxTools.ColumnFromDisplayIndex(columnDisplayIndex);

                    // now telling the grid, that we handled the key down event
                    //e.Handled = true;

                    // setting the current cell (selected, focused)
                    dgvAuxTools.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvAuxTools.SelectedItem, nextColumn);

                    // tell the grid to initialize edit mode for the current cell
                    dgvAuxTools.BeginEdit();
                }

                //else if (e.Key == Key.Enter || e.Key == Key.Tab) //original
                else if (e.Key == Key.Enter || e.Key == Key.Tab || e.Key == Key.Right)
                {
                    if (e.Key == Key.Right)
                    {
                        try
                        {
                            System.Windows.Controls.DataGridCellInfo dgt = dgvToolSchedule.CurrentCell;
                            var cellContent = (TextBox)dgt.Column.GetCellContent(dgt.Item);
                            //cellContent.SelectionLength
                            if (cellContent != null)
                            {
                                if (cellContent.SelectionLength != cellContent.Text.Length)
                                {
                                    return;
                                }

                                //    TextBox
                            }
                        }
                        catch (Exception ex)
                        {
                            return;
                        }
                    }
                    //end add by nandakumar
                    //System.Windows.Controls.DataGridColumn nextColumn = dgvAuxTools.ColumnFromDisplayIndex(columnDisplayIndex);

                    //// now telling the grid, that we handled the key down event
                    ////e.Handled = true;

                    //// setting the current cell (selected, focused)
                    //dgvAuxTools.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvAuxTools.SelectedItem, nextColumn);

                    //// tell the grid to initialize edit mode for the current cell
                    //dgvAuxTools.BeginEdit();

                    if (columnDisplayIndex == 6)
                    {
                        columnDisplayIndex        = 0;
                        dgvAuxTools.SelectedIndex = dgvAuxTools.SelectedIndex + 1;
                    }
                    else
                    {
                        columnDisplayIndex = columnDisplayIndex + 1;
                    }
                    int selectedIndex = 0;
                    selectedIndex = dgvAuxTools.SelectedIndex;

                    System.Windows.Controls.DataGridColumn nextColumn = dgvAuxTools.ColumnFromDisplayIndex(columnDisplayIndex);
                    // now telling the grid, that we handled the key down event
                    e.Handled = true;
                    // setting the current cell (selected, focused)
                    dgvAuxTools.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvAuxTools.SelectedItem, nextColumn);
                    dgvAuxTools.ScrollIntoView(dgvAuxTools.CurrentCell);
                    // tell the grid to initialize edit mode for the current cell
                    dgvAuxTools.BeginEdit();
                }
            }
            catch (Exception ex)
            {
                ex.LogException();
            }
        }
 /// <summary>
 ///     Instantiates a new instance of this class.
 /// </summary>
 public DataGridColumnEventArgs(DataGridColumn column)
 {
     _column = column;
 }
        //private void LoadData(string columnSet)
        //{
        //	var dataGrid =  TradeLink.DBContext.DBService.Data.DataGridGroups.Expand("DataGridColumns").Where(p => p.Name == columnSet).FirstOrDefault();
        //	this.CreateColumn(dataGrid);
        //}

        //private void CreateColumn(DataGridGroup dataGrid)
        //{
        //	var dgcg = new DataGridColumnGen();
        //	foreach (var column in dataGrid.DataGridColumns)
        //	{
        //		dgcg.Width = column.Width;
        //		dgcg.Type = column.Type;
        //		dgcg.Sequence = column.Sequence;
        //		dgcg.UpdateTriggerId = column.UpdateTriggerId;
        //		dgcg.HasFilter = column.HasFilter;
        //		dgcg.Header = column.Header;
        //		dgcg.Path = column.Path;
        //		dgcg.Format = column.Format;
        //		dgcg.CellTemplate = column.CellTemplate;
        //		dgcg.CellStyle = column.CellStyle;
        //		if (column.Binding_Id.HasValue)
        //			dgcg.Binding_Id = column.Binding_Id.Value;

        //		this.GenerateDataGridColumn(dgcg);
        //	}
        //}

        public void GenerateDataGridColumn(DataGridColumnGen column)
        {
            System.Windows.Controls.DataGridColumn col = null;

            switch (column.Type)
            {
            case 1:        //Text
                col = new Glass.UX.Windows.Controls.DataGridTextColumn();
                break;

            case 2:        //Combo
                col = new Glass.UX.Windows.Controls.DataGridComboBoxColumn();
                break;

            case 3:        //Check
                col = new Glass.UX.Windows.Controls.DataGridCheckBoxColumn();
                break;

            case 4:        //Numeric
                col = new DataGridNumericColumn();
                break;

            case 5:        //Currency
                col = new DataGridNumericColumn();
                break;

            case 6:        //Date
                col = new DataGridDateColumn();
                break;

            case 7:        //Template
                col = new DataGridTemplateColumn();
                ((DataGridTemplateColumn)col).CellTemplate = AssociatedObject.TryFindResource(column.CellTemplate) as DataTemplate;
                break;

            case 8:        //Details
                col       = new DataGridDetailColumn();
                col.Width = column.Width;
                break;
            }

            if (col != null)
            {
                Binding binding = null;
                if (!String.IsNullOrEmpty(column.Path))
                {
                    binding = new Binding(column.Path);
                }
                if (!String.IsNullOrEmpty(column.Format) && binding != null)
                {
                    binding.StringFormat = column.Format;
                }
                if (!String.IsNullOrEmpty(column.Header))
                {
                    col.Header = column.Header;
                }
                if (!String.IsNullOrEmpty(column.CellStyle))
                {
                    col.CellStyle = AssociatedObject.TryFindResource(column.CellStyle) as Style;
                }

                if (column.HasFilter)
                {
                    col.HeaderStyle = Application.Current.Resources["DataGridColumnFilterHeaderStyle"] as Style;
                }

                if (col is DataGridBoundColumn)
                {
                    ((DataGridBoundColumn)col).Binding = binding;
                }
                AssociatedObject.Columns.Add(col);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Windows.Controls.DataGridAutoGeneratingColumnEventArgs" /> class.
 /// </summary>
 /// <param name="propertyName">
 /// The name of the property bound to the generated column.
 /// </param>
 /// <param name="propertyType">
 /// The <see cref="T:System.Type" /> of the property bound to the generated column.
 /// </param>
 /// <param name="column">
 /// The generated column.
 /// </param>
 public DataGridAutoGeneratingColumnEventArgs(string propertyName, Type propertyType, DataGridColumn column)
 {
     this.Column       = column;
     this.PropertyName = propertyName;
     this.PropertyType = propertyType;
 }
 // Token: 0x0600472B RID: 18219 RVA: 0x0014267C File Offset: 0x0014087C
 private DataGridCellInfo(DataGrid owner, DataGridColumn column, object item)
 {
     this._info   = owner.NewItemInfo(item, null, -1);
     this._column = column;
     this._owner  = new WeakReference(owner);
 }
 public DataGridCellEditEndingEventArgs(DataGridColumn column, DataGridRow row, System.Windows.FrameworkElement editingElement, DataGridEditAction editAction)
 {
 }
示例#57
0
        private void dgvPccsRevisions_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                int columnDisplayIndex = dgvPccsRevisions.CurrentCell.Column.DisplayIndex;

                if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) || e.Key == Key.Left)
                //new
                //if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift))
                //new end
                {
                    //new
                    if (e.Key == Key.Left)
                    {
                        try
                        {
                            Microsoft.Windows.Controls.DataGridCellInfo dgt = dgvPccs.CurrentCell;
                            var cellContent = (TextBox)dgt.Column.GetCellContent(dgt.Item);
                            //cellContent.SelectionLength
                            if (cellContent != null)
                            {
                                if (cellContent.SelectionLength != cellContent.Text.Length)
                                {
                                    return;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            return;
                        }
                    }
                    //end new
                    e.Handled = true;
                    //int columnDisplayIndex = dgvPccsRevisions.CurrentCell.Column.DisplayIndex;
                    if (columnDisplayIndex == 0)
                    {
                        dgvPccsRevisions.SelectedIndex = dgvPccsRevisions.SelectedIndex - 1;
                        columnDisplayIndex             = dgvPccsRevisions.Columns.Count - 1;
                    }
                    else
                    {
                        if (columnDisplayIndex == 1)
                        {
                            columnDisplayIndex = 0;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex - 1;
                        }
                    }
                    System.Windows.Controls.DataGridColumn nextColumn = dgvPccsRevisions.ColumnFromDisplayIndex(columnDisplayIndex);

                    // now telling the grid, that we handled the key down event
                    //e.Handled = true;

                    // setting the current cell (selected, focused)
                    dgvPccsRevisions.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvPccsRevisions.SelectedItem, nextColumn);
                    string str = dgvPccsRevisions.CurrentCell.Item.ToValueAsString();
                    // tell the grid to initialize edit mode for the current cell
                    dgvPccsRevisions.BeginEdit();
                }
                else
                {
                    if (e.Key == Key.Tab || e.Key == Key.Right)
                    //new
                    //if (e.Key == Key.Tab)
                    //new end
                    {
                        //int columnDisplayIndex = dgvPccsRevisions.CurrentCell.Column.DisplayIndex;
                        //if (dgvPccsRevisions.SelectedIndex == dgvPccsRevisions.Items.Count - 1)
                        //{
                        //    if (columnDisplayIndex == dgvPccsRevisions.Columns.Count - 1)
                        //    {
                        //        dgvPccsRevisions.Focus();
                        //    }
                        //}
                        //new
                        if (e.Key == Key.Right)
                        {
                            try
                            {
                                Microsoft.Windows.Controls.DataGridCellInfo dgt = dgvPccs.CurrentCell;
                                var cellContent = (TextBox)dgt.Column.GetCellContent(dgt.Item);
                                //cellContent.SelectionLength
                                if (cellContent != null)
                                {
                                    if (cellContent.SelectionLength != cellContent.Text.Length)
                                    {
                                        return;
                                    }

                                    //    TextBox
                                }
                            }
                            catch (Exception ex)
                            {
                                return;
                            }
                        }
                        //end new
                        if (columnDisplayIndex == 3)
                        {
                            columnDisplayIndex             = 0;
                            dgvPccsRevisions.SelectedIndex = dgvPccsRevisions.SelectedIndex + 1;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex + 1;
                        }
                        int selectedIndex = 0;
                        selectedIndex = dgvPccsRevisions.SelectedIndex;

                        System.Windows.Controls.DataGridColumn nextColumn = dgvPccsRevisions.ColumnFromDisplayIndex(columnDisplayIndex);
                        // now telling the grid, that we handled the key down event
                        e.Handled = true;
                        // setting the current cell (selected, focused)
                        dgvPccsRevisions.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvPccsRevisions.SelectedItem, nextColumn);
                        dgvPccsRevisions.ScrollIntoView(dgvPccsRevisions.CurrentCell);
                        // tell the grid to initialize edit mode for the current cell
                        dgvPccsRevisions.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
 public DataGridColumnEventArgs(DataGridColumn column)
 {
 }
示例#59
0
        private void dgvProdDwgMast_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                int columnDisplayIndex = dgvProdDwgMast.CurrentCell.Column.DisplayIndex;

                //if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) || e.Key == Key.Left)
                if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift))
                {
                    e.Handled = true;
                    int leftDisplayIndex = 0;

                    if (vm.DrwModel.DWG_TYPE_DESC.ToValueAsString() == "Sequence Drawing")
                    {
                        leftDisplayIndex = 0;
                    }
                    else
                    {
                        leftDisplayIndex = 1;
                    }

                    if (columnDisplayIndex == leftDisplayIndex)
                    {
                        dgvProdDwgMast.SelectedIndex = dgvProdDwgMast.SelectedIndex - 1;
                        columnDisplayIndex           = dgvProdDwgMast.Columns.Count - 1;
                    }
                    else
                    {
                        if (columnDisplayIndex == 1)
                        {
                            columnDisplayIndex = 0;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex - 1;
                        }
                    }
                    System.Windows.Controls.DataGridColumn nextColumn = dgvProdDwgMast.ColumnFromDisplayIndex(columnDisplayIndex);

                    // now telling the grid, that we handled the key down event
                    //e.Handled = true;

                    // setting the current cell (selected, focused)
                    dgvProdDwgMast.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvProdDwgMast.SelectedItem, nextColumn);

                    // tell the grid to initialize edit mode for the current cell
                    dgvProdDwgMast.BeginEdit();
                }
                else
                {
                    //if (e.Key == Key.Tab || e.Key == Key.Right)
                    if (e.Key == Key.Tab)
                    {
                        int displayIndex = 0;

                        if (vm.DrwModel.DWG_TYPE_DESC.ToValueAsString() == "Sequence Drawing")
                        {
                            displayIndex = 0;
                        }
                        else
                        {
                            displayIndex = 1;
                        }

                        if (columnDisplayIndex == 4)
                        {
                            columnDisplayIndex           = displayIndex;
                            dgvProdDwgMast.SelectedIndex = dgvProdDwgMast.SelectedIndex + 1;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex + 1;
                        }
                        int selectedIndex = 0;
                        selectedIndex = dgvProdDwgMast.SelectedIndex;

                        System.Windows.Controls.DataGridColumn nextColumn = dgvProdDwgMast.ColumnFromDisplayIndex(columnDisplayIndex);
                        // now telling the grid, that we handled the key down event
                        e.Handled = true;
                        // setting the current cell (selected, focused)
                        dgvProdDwgMast.CurrentCell = new System.Windows.Controls.DataGridCellInfo(dgvProdDwgMast.SelectedItem, nextColumn);
                        dgvProdDwgMast.ScrollIntoView(dgvProdDwgMast.CurrentCell);
                        // tell the grid to initialize edit mode for the current cell
                        dgvProdDwgMast.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#60
0
        private void ssAssumtions_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                int columnDisplayIndex = ssAssumtions.CurrentCell.Column.DisplayIndex;
                //if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) || e.Key == Key.Left)
                if ((e.Key == Key.Tab && (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift))
                {
                    e.Handled = true;

                    if (columnDisplayIndex == 2)
                    {
                        ssAssumtions.SelectedIndex = ssAssumtions.SelectedIndex - 1;
                        columnDisplayIndex         = ssAssumtions.Columns.Count - 1;
                    }
                    else
                    {
                        if (columnDisplayIndex == 1)
                        {
                            columnDisplayIndex = 0;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex - 1;
                        }
                    }
                    System.Windows.Controls.DataGridColumn nextColumn = ssAssumtions.ColumnFromDisplayIndex(columnDisplayIndex);

                    // now telling the grid, that we handled the key down event
                    //e.Handled = true;

                    // setting the current cell (selected, focused)
                    ssAssumtions.CurrentCell = new System.Windows.Controls.DataGridCellInfo(ssAssumtions.SelectedItem, nextColumn);

                    // tell the grid to initialize edit mode for the current cell
                    ssAssumtions.BeginEdit();
                }
                else
                {
                    //if (e.Key == Key.Tab || e.Key == Key.Right)
                    if (e.Key == Key.Tab)
                    {
                        if (columnDisplayIndex == 6)
                        {
                            columnDisplayIndex         = 2;
                            ssAssumtions.SelectedIndex = ssAssumtions.SelectedIndex + 1;
                        }
                        else
                        {
                            columnDisplayIndex = columnDisplayIndex + 1;
                        }
                        int selectedIndex = 0;
                        selectedIndex = ssAssumtions.SelectedIndex;

                        System.Windows.Controls.DataGridColumn nextColumn = ssAssumtions.ColumnFromDisplayIndex(columnDisplayIndex);
                        // now telling the grid, that we handled the key down event
                        e.Handled = true;
                        // setting the current cell (selected, focused)
                        ssAssumtions.CurrentCell = new System.Windows.Controls.DataGridCellInfo(ssAssumtions.SelectedItem, nextColumn);
                        ssAssumtions.ScrollIntoView(ssAssumtions.CurrentCell);
                        // tell the grid to initialize edit mode for the current cell
                        ssAssumtions.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }