public DsxFilterPopup(DsxColumn column) { this.Column = column; this.Column.FilterTextChanged += delegate { if (this.PART_Popup != null) { this.PART_Popup.IsOpen = false; } }; }
public DsxColumn(GridViewColumn gridViewColumn, DsxDataGrid DataGrid) { this.DataGrid = DataGrid; this.CellTemplate = gridViewColumn.CellTemplate; this.CellTemplateSelector = gridViewColumn.CellTemplateSelector; this.DisplayMemberBinding = gridViewColumn.DisplayMemberBinding; this.Header = gridViewColumn.Header; this.Width = gridViewColumn.Width; DsxColumn _gridViewColumn = gridViewColumn as DsxColumn; if (_gridViewColumn != null) { this.ColumnArea = _gridViewColumn.ColumnArea; this.FieldName = _gridViewColumn.FieldName; this.StringFormat = _gridViewColumn.StringFormat; this.ViewType = _gridViewColumn.ViewType; this.EditType = _gridViewColumn.EditType; this.FilterType = _gridViewColumn.FilterType; this.FooterType = _gridViewColumn.FooterType; this.HeaderStyle = _gridViewColumn.HeaderStyle; this.FilterStyle = _gridViewColumn.FilterStyle; this.FooterStyle = _gridViewColumn.FooterStyle; this.RowCellStyle = _gridViewColumn.RowCellStyle; this.IsSizable = _gridViewColumn.IsSizable; this.IsSortable = _gridViewColumn.IsSortable; this.CellContentSize = _gridViewColumn.CellContentSize; this.CellContentItemsSource = _gridViewColumn.CellContentItemsSource; this.CellContentBackground = _gridViewColumn.CellContentBackground; this.CellContentRangeMin = _gridViewColumn.CellContentRangeMin; this.CellContentRangeMax = _gridViewColumn.CellContentRangeMax; this.CellContentIsClickable = _gridViewColumn.CellContentIsClickable; this.CellHAlign = _gridViewColumn.CellHAlign; this.CellBackground = _gridViewColumn.CellBackground; this.CellForeground = _gridViewColumn.CellForeground; this.CellFontFamily = _gridViewColumn.CellFontFamily; this.CellFontSize = _gridViewColumn.CellFontSize; this.CellFontWeight = _gridViewColumn.CellFontWeight; this.FilterCriteria = _gridViewColumn.FilterCriteria; InitViewDisplay(); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null && value is DsxColumn) { DsxColumn _gridViewColumn = value as DsxColumn; if (_gridViewColumn.IsFilterActive) { return(Visibility.Visible); } } return(Visibility.Hidden); }
public EditAdorner(DsxDataGrid DataGrid, DsxColumn gridViewColumn, FrameworkElement gridViewCell, bool isFilter) : base(gridViewCell) { this.IsFilter = isFilter; this.Focusable = false; this.VisualChildren = new VisualCollection(this); this.DataGrid = DataGrid; this.Column = gridViewColumn; InitEditing(gridViewCell); this.EditCtrl.LostFocus += OnLostFocus; }
private static void OnDsxColumnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d == null || e.NewValue == null) { return; } DsxRowCell <T> _context = (DsxRowCell <T>)d; DsxColumn _newValue = (DsxColumn)e.NewValue; DsxColumn _oldValue = (DsxColumn)e.OldValue; if (_newValue != _oldValue) { _context.InitElement(_newValue, false); } }
public static object FindStyleValue(object value, string propertyName, DependencyProperty defaultStyleDP, DependencyProperty columnStyleDP) { object _result = null; Style _defaultStyle = null; Style _columnStyle = null; GridViewColumnHeader _header = null; DsxColumn _column = null; if (value is DsxDataGrid) { _defaultStyle = (Style)((DsxDataGrid)value).GetValue(defaultStyleDP); } else if (value is GridViewColumnHeader) { _header = (GridViewColumnHeader)value; _column = (DsxColumn)_header.Column; } else { _column = (DsxColumn)value; } if (_column != null) { _defaultStyle = (Style)_column.DataGrid.GetValue(defaultStyleDP); _columnStyle = (Style)_column.GetValue(columnStyleDP); } else if (_defaultStyle == null) { // remind: padding empty columns have no column assigned in the GridViewColumnHeader DsxDataGrid _dataGrid = ElementHelper.FindLogicalParent <DsxDataGrid>(_header); if (_dataGrid != null) { _defaultStyle = (Style)_dataGrid.GetValue(defaultStyleDP); } } // apply current (column) Style // fall back to default Style _result = _columnStyle.GetStylePropertyValue <object>(propertyName, _defaultStyle, null); return(_result); }
private static void OnFilterTextValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d == null) { return; } DsxColumn _context = (DsxColumn)d; string _newValue = (string)e.NewValue; string _oldValue = (string)e.OldValue; if (_newValue != _oldValue && _context.FilterTextChanged != null) { _context.FilterTextChanged(_context, null); } _context.FilterUpdateDisplay(); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (parameter == null || parameter.ToString() == String.Empty) { return(Visibility.Collapsed); } bool _checkBox = parameter.ToString() == "CheckDisplay"; if (value != null && value is DsxColumn) { DsxColumn _column = value as DsxColumn; if (_column.FilterType == EEditType.CheckBox) { return(_checkBox ? Visibility.Visible : Visibility.Collapsed); } else { return(_checkBox ? Visibility.Collapsed : Visibility.Visible); } } return(Visibility.Collapsed); }
internal void InitElement(DsxColumn DsxColumn, bool isDecorator) { if (this.Child != null) { return; } this.Child = (FrameworkElement) new T(); FrameworkElement _element = (FrameworkElement)this.Child; // _element.Style = this.DsxColumn.RowCellStyle; this.IsDecorator = isDecorator; if (_element != null) { _element.Focusable = false; _element.IsHitTestVisible = true; _element.FocusVisualStyle = null; _element.IsEnabled = false; _element.HorizontalAlignment = HorizontalAlignment.Left; _element.VerticalAlignment = VerticalAlignment.Top; _element.FocusVisualStyle = null; } this.IsTextBlock = this.Child is TextBlock; this.IsBullet = this.Child is BulletChrome; this.IsCheckBox = this.Child is CheckBox; this.IsImage = this.Child is Image; this.IsProgressBar = this.Child is DsxCellProgressBar; if (this.IsTextBlock) { _element.Margin = new Thickness(0, 2, 0, 0); _element.HorizontalAlignment = HorizontalAlignment.Stretch; _element.VerticalAlignment = VerticalAlignment.Stretch; (_element as TextBlock).Padding = new Thickness(6, 0, 6, 0); } if (this.IsBullet) { _element.Margin = new Thickness(0, 3, 0, 0); _element.Height = 13.0; _element.Width = 13.0; _element.Opacity = this.IsDecorator ? 0.0 : 1.0; } if (this.IsCheckBox) { _element.IsEnabled = true; _element.Margin = new Thickness(0, 4, 0, 0); _element.Height = 13.0; _element.Width = 13.0; } if (this.IsImage) { _element.Margin = new Thickness(0, 2, 0, 0); _element.Height = this.CellContentSize.Height; _element.Width = this.CellContentSize.Width; } if (this.IsProgressBar) { _element.HorizontalAlignment = HorizontalAlignment.Stretch; _element.VerticalAlignment = VerticalAlignment.Top; _element.Margin = new Thickness(2, 2, 8, 1); _element.Height = this.CellContentSize.Height; (_element as DsxCellProgressBar).ContentBackground = this.CellContentBackground; } }