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));
        }
Beispiel #2
0
 internal static void SetCellManager(DataGridCell element, CellManager value)
 {
     element.SetValue(CellManagerProperty, value);
 }