Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Brush _result = Brushes.Transparent;

            if (value == null)
            {
                return(_result);
            }
            ListViewItem _listItem = (ListViewItem)value;
            ListView     _listView = ItemsControl.ItemsControlFromItemContainer(_listItem) as ListView;

            if (_listView.AlternationCount > 0)
            {
                int         _index    = (int)_listItem.GetValue(ItemsControl.AlternationIndexProperty);
                DsxDataGrid _dataGrid = (_listView.View as DsxGridView).ParentDataGrid;

                if (_dataGrid.AlternatingRowBrushes != null && _dataGrid.AlternatingRowBrushes.Count > _index)
                {
                    _result = _dataGrid.AlternatingRowBrushes[_index];
                }
            }

            return(_result);
        }
Ejemplo n.º 5
0
 public DsxHeightTracker(DsxDataGrid dataGrid)
 {
     this.DataGrid   = dataGrid;
     this.RowHeights = new List <double>();
     this.DirtyItems = new List <object>();
 }