TreeGridCell CreateCell(TreeGridColumn column)
        {
            TreeGridCell cc;

            if (this.OwnerRow.IsHeaderRow)
            {
                cc = new TreeGridHeaderCell { Column = column, OwnerRow = this.OwnerRow };
                cc.DataContext = column;
                cc.SetBinding(TreeGridCell.ContentTemplateProperty, new Binding { Source = column, Path = new PropertyPath(TreeGridColumn.HeaderTemplateProperty) });
                cc.SetBinding(TreeGridCell.ContentProperty, new Binding { Source = column, Path = new PropertyPath(TreeGridColumn.HeaderProperty) });
                cc.SetBinding(TreeGridHeaderCell.ContextMenuProperty, new Binding { Source = column, Path = new PropertyPath(TreeGridColumn.ContextMenuProperty) });
                cc.Loaded += OnHeaderCellLoaded;
            }
            else
            {
                cc = new TreeGridCell { Column = column, OwnerRow = this.OwnerRow };
                cc.SetBinding(TreeGridCell.DataContextProperty, rowDataBinding);
                cc.SetBinding(TreeGridCell.ContentProperty, column.CellBinding ?? this.rowDataBinding);
                cc.SetBinding(TreeGridCell.ContentTemplateProperty, new Binding { Source = column, Path = new PropertyPath(TreeGridColumn.CellTemplateProperty) });
                column.PropertyChanged += OnColumnPropertyChanged;
            }

            this.Children.Add(cc);
            return cc;
        }
        TreeGridCell CreateCell(TreeGridColumn column)
        {
            TreeGridCell cc;

            if (this.OwnerRow.IsHeaderRow)
            {
                cc = new TreeGridHeaderCell {
                    Column = column, OwnerRow = this.OwnerRow
                };
                cc.DataContext = column;
                cc.SetBinding(TreeGridCell.ContentTemplateProperty, new Binding {
                    Source = column, Path = new PropertyPath(TreeGridColumn.HeaderTemplateProperty)
                });
                cc.SetBinding(TreeGridCell.ContentProperty, new Binding {
                    Source = column, Path = new PropertyPath(TreeGridColumn.HeaderProperty)
                });
                cc.SetBinding(TreeGridHeaderCell.ContextMenuProperty, new Binding {
                    Source = column, Path = new PropertyPath(TreeGridColumn.ContextMenuProperty)
                });
                cc.Loaded += OnHeaderCellLoaded;
            }
            else
            {
                cc = new TreeGridCell {
                    Column = column, OwnerRow = this.OwnerRow
                };
                cc.SetBinding(TreeGridCell.DataContextProperty, rowDataBinding);
                cc.SetBinding(TreeGridCell.ContentProperty, column.CellBinding ?? this.rowDataBinding);
                cc.SetBinding(TreeGridCell.ContentTemplateProperty, new Binding {
                    Source = column, Path = new PropertyPath(TreeGridColumn.CellTemplateProperty)
                });
                column.PropertyChanged += OnColumnPropertyChanged;
            }

            this.Children.Add(cc);
            return(cc);
        }
        public bool TryGetDesiredCellWidth(TreeGridColumn column, out double desiredWidth)
        {
            TreeGridCell cc;

            if (this.cells.TryGetValue(column, out cc) && cc.IsLoaded)
            {
                desiredWidth = cc.DesiredSize.Width;
                return true;
            }

            desiredWidth = 0;
            return false;
        }
 void RemoveCell(TreeGridColumn oldColumn)
 {
     this.Children.Remove(this.cells[oldColumn]);
     oldColumn.PropertyChanged -= OnColumnPropertyChanged;
     this.cells.Remove(oldColumn);
 }
Exemple #5
0
 internal bool TryGetDesiredCellWidth(TreeGridColumn column, out double desiredWidth)
 {
     return this.panel.TryGetDesiredCellWidth(column, out desiredWidth);
 }
 void RemoveCell(TreeGridColumn oldColumn)
 {
     this.Children.Remove(this.cells[oldColumn]);
     oldColumn.PropertyChanged -= OnColumnPropertyChanged;
     this.cells.Remove(oldColumn);
 }