コード例 #1
0
ファイル: DsxFilterPopup.cs プロジェクト: hansuky/Yuhan
 public DsxFilterPopup(DsxColumn column)
 {
     this.Column     = column;
     this.Column.FilterTextChanged += delegate
                                         {
                                             if (this.PART_Popup != null)
                                             {
                                                 this.PART_Popup.IsOpen=false;
                                             }
                                         };
 }
コード例 #2
0
 public DsxFilterPopup(DsxColumn column)
 {
     this.Column = column;
     this.Column.FilterTextChanged += delegate
     {
         if (this.PART_Popup != null)
         {
             this.PART_Popup.IsOpen = false;
         }
     };
 }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: EditAdorner.cs プロジェクト: robocik/BodyArchitect
        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;
        }
コード例 #5
0
ファイル: DsxRowCell.cs プロジェクト: robocik/BodyArchitect
        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);
            }
        }
コード例 #6
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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
ファイル: DsxDataGrid.cs プロジェクト: hansuky/Yuhan
        private void CreateColumnLayout()
        {
            DsxColumn   _gridViewColumn;
            int         _gridColCount = 0;

            if (!this.IsInitialized)
            {
                return;
            }

            if (this.InnerColumns.Count > 0)
            {
                if (this.IsGridAreaLeft)
                {
                    this.PART_ListViewLeft .RemoveHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnGridViewColumnHeaderClicked));
                }
                if (this.IsGridAreaCenter)
                {
                    this.PART_ListViewCenter.RemoveHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnGridViewColumnHeaderClicked));
                }
                if (this.IsGridAreaRight)
                {
                    this.PART_ListViewRight .RemoveHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnGridViewColumnHeaderClicked));
                }

                this.PART_GridViewLeft  .Columns.Clear();
                this.PART_GridViewCenter.Columns.Clear();
                this.PART_GridViewRight .Columns.Clear();

                this.InnerColumns .Clear();
                this.FilterColumns.Clear();
                this.FooterColumns.Clear();
            }

            //  map the columns (we need DsxColumns)
            foreach(GridViewColumn _column in this.Columns)
            {
                _gridViewColumn = new DsxColumn(_column, this);

                //  filtering
                if (_gridViewColumn.IsFilterActive)
                {
                    _gridViewColumn.FilterTextChanged += OnColumnFilterTextChanged;
                    this.FilterColumns.Add(_gridViewColumn);
                }

                //  summaries
                if (_gridViewColumn.IsFooterActive)
                {
                    this.FooterColumns.Add(_gridViewColumn);
                }

                //  columns
                DsxGridView _gridView = GetGridView(_gridViewColumn.ColumnArea);

                            _gridViewColumn.ColAreaIndex = _gridView.Columns.Count;
                            _gridViewColumn.ColIndex     = _gridColCount;
                            _gridColCount++;

                            _gridView.Columns.Add(_gridViewColumn);

                this.InnerColumns.Add(_gridViewColumn);
            }

            this.AreaLeftColCount   = this.PART_GridViewLeft  .Columns.Count;
            this.AreaCenterColCount = this.PART_GridViewCenter.Columns.Count;
            this.AreaRightColCount  = this.PART_GridViewRight .Columns.Count;

            this.IsGridAreaLeft     = this.AreaLeftColCount   > 0;
            this.IsGridAreaCenter   = this.AreaCenterColCount > 0;
            this.IsGridAreaRight    = this.AreaRightColCount  > 0;

            if (this.IsGridAreaLeft)
            {
                this.PART_ListViewLeft.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnGridViewColumnHeaderClicked));
            }
            else
            {
                this.AreaLeftWidth          = new GridLength(0.0);
                this.SplitterLeftIsSizing   = false;
                this.SplitterLeftWidth      = new GridLength(0.0);
            }

            if (this.IsGridAreaCenter)
            {
                this.PART_ListViewCenter.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnGridViewColumnHeaderClicked));
            }
            else
            {
                this.AreaCenterWidth        = new GridLength(0.0);
                this.SplitterRightIsSizing  = false;
                this.SplitterRightWidth     = new GridLength(0.0);
                this.AreaRightWidth         = new GridLength(this.AreaRightWidth.Value, GridUnitType.Star);
            }

            if (this.IsGridAreaRight)
            {
                this.PART_ListViewRight.AddHandler(GridViewColumnHeader.ClickEvent, new RoutedEventHandler(OnGridViewColumnHeaderClicked));
            }
            else if (this.Columns.Count>0)
            {
                throw new NotSupportedException("at least one column must be in the right area");
            }

            //  check the limitations
            if (this.IsGridAreaLeft || this.IsGridAreaCenter)
            {
                if (this.IsVirtualizing)
                {
                    throw new NotSupportedException("Multiple areas and IsVirtualizing are not allowed: turn off IsVirtualizing");
                }
                if (this.ItemFixHeight == 0.0 || this.ItemMinHeight != 0.0 || this.ItemMaxHeight != 0.0)
                {
                    throw new NotSupportedException("Multiple areas and variable ItemHeight are not allowed: set ItemFixHeight and turn off ItemMinHeight/ItemMaxHeight");
                }
            }
        }
コード例 #9
0
ファイル: DsxDataGrid.cs プロジェクト: hansuky/Yuhan
 public void SetEditCell(DsxColumn gridViewColumn, FrameworkElement gridViewCell)
 {
     if (this.LastFocusColumn != gridViewColumn || this.LastFocusCell != gridViewCell)
     {
         throw new Exception("SetEditCell");
     }
     else
     {
         AddEditAdorner();
     }
 }
コード例 #10
0
ファイル: DsxDataGrid.cs プロジェクト: hansuky/Yuhan
        private void SetSortColumn(DsxColumn sortColumn, GridViewColumnHeader sortHeader)
        {
            if (sortColumn != null && sortColumn.IsSortable && sortHeader != null)
            {
                //  remove an existing adorner
                if (this.SortHeader != null)
                {
                    AdornerLayer _adorner = AdornerLayer.GetAdornerLayer(this.SortHeader);
                    if (_adorner != null)
                    {
                        _adorner.Remove(this.SortAdorner);
                    }
                }

                if (this.SortColumn != sortColumn)
                {
                    sortColumn.SortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    sortColumn.SortDirection = sortColumn.SortDirection == ListSortDirection.Ascending
                                                                            ? ListSortDirection.Descending
                                                                            : ListSortDirection.Ascending;
                }

                this.SortHeader   = sortHeader;
                this.SortColumn   = sortColumn;
                this.SortField    = SortColumn.FieldName;

                //  create adorner
                if (this.SortHeader != null)
                {
                    this.SortAdorner = new SortAdorner(this.SortHeader, sortColumn.SortDirection);
                    AdornerLayer.GetAdornerLayer(this.SortHeader).Add(this.SortAdorner);
                }

                RecalcDisplaySource();
            }
        }
コード例 #11
0
ファイル: DsxRowCell.cs プロジェクト: robocik/BodyArchitect
        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;
            }
        }