Esempio n. 1
0
        //-----------------------------------------------------------------------
        protected override FrameworkElement GenerateEditingElement(
            DataGridCell cell,
            object dataItem)
        {
            var fileSystemSelectionControl = new FileSystemSelectionControl();

            if (!BindIfNotNull(
                    fileSystemSelectionControl,
                    FileSystemSelectionControl.FileFilterProperty,
                    this.FileFilterBinding))
            {
                fileSystemSelectionControl.FileFilter = this.FileFilter;
            }

            if (!BindIfNotNull(
                    fileSystemSelectionControl,
                    FileSystemSelectionControl.ModeProperty,
                    this.ModeBinding))
            {
                fileSystemSelectionControl.Mode = this.Mode;
            }

            fileSystemSelectionControl.SetBinding(
                FileSystemSelectionControl.SelectedPathProperty,
                this.Binding);
            cell.SetBinding(DataGridCell.ToolTipProperty, this.Binding);

            return(fileSystemSelectionControl);
        }
        protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
        {
            if (dataItem == null || dataItem == CollectionView.NewItemPlaceholder)
            {
                return(base.GenerateElement(cell, dataItem));
            }

            //var items = dataItem as IEnumerable;
            //if (items == null)
            //    throw new Exception(
            //        "When using DynamicGrid, ItemsSource must implement IEnumerable " +
            //        "and its members must implement IEnumerable. For better performance " +
            //        "its members should also implement IList.");
            var manager = new CellManager(_grid, dataItem, Info);

            DynamicGrid.SetCellManager(cell, manager);
            cell.SetBinding(FrameworkElement.DataContextProperty, new Binding("Data")
            {
                Source = manager
            });
            return(base.GenerateElement(cell, manager.Data));
        }