Inheritance: System.Windows.Controls.Control
        private StackPanel GeneratePanel(object dataItem)
        {
            StackPanel panel = new StackPanel();

            panel.Orientation = Orientation.Horizontal;

            IGanttNode node = (IGanttNode)dataItem;

            Binding bind = new Binding("Level");

            bind.ConverterParameter = dataItem;
            bind.Mode      = BindingMode.OneWay;
            bind.Converter = new LevelToWidthConverter();

            Border b = new Border();

            b.BorderThickness = new Thickness(0);
            b.Background      = new SolidColorBrush(Colors.Transparent);
            b.SetBinding(Border.WidthProperty, bind);

            bind      = new Binding("Expanded");
            bind.Mode = BindingMode.TwoWay;

            SimpleExpander expander = new SimpleExpander();

            expander.Visibility         = (node.ChildNodes.Count == 0) ? Visibility.Collapsed : Visibility.Visible;
            expander.IsExpandedChanged += new EventHandler(expander_IsExpandedChanged);
            expander.SetBinding(SimpleExpander.IsExpandedProperty, bind);

            panel.Children.Add(b);
            panel.Children.Add(expander);

            return(panel);
        }
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            Border b = new Border();

            SimpleExpander Expander = new SimpleExpander();
            Expander.SetBinding(SimpleExpander.IsExpandedProperty, this.Binding);
            Expander.Visibility = ((dataItem as IGanttNode).ChildNodes.Count > 0) ? Visibility.Visible : Visibility.Collapsed;
            b.Child = Expander;

            return b;
        }
Beispiel #3
0
        protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
        {
            Border b = new Border();

            SimpleExpander Expander = new SimpleExpander();

            Expander.SetBinding(SimpleExpander.IsExpandedProperty, this.Binding);
            Expander.Visibility = ((dataItem as IGanttNode).ChildNodes.Count > 0) ? Visibility.Visible : Visibility.Collapsed;
            b.Child             = Expander;

            return(b);
        }
        void Row_Loaded(object sender, RoutedEventArgs e)
        {
            var row = (DataGridRow)sender;

            row.Loaded -= Row_Loaded;

            int rowIndex = row.GetIndex();

            SimpleExpander ex = ((GanttExpanderColumn)Columns[0]).GetExpander(row);

            if (ex.UseAnimation = LastExpanderClickedIndex == rowIndex)
            {
                LastExpanderClickedIndex = -1;
            }
        }
        private StackPanel GeneratePanel(object dataItem)
        {
            StackPanel panel = new StackPanel();
            panel.Orientation = Orientation.Horizontal;

            IGanttNode node = (IGanttNode)dataItem;

            Binding bind = new Binding("Level");
            bind.ConverterParameter = dataItem;
            bind.Mode = BindingMode.OneWay;
            bind.Converter = new LevelToWidthConverter();

            Border b = new Border();
            b.BorderThickness = new Thickness(0);
            b.Background = new SolidColorBrush(Colors.Transparent);
            b.SetBinding(Border.WidthProperty, bind);

            bind = new Binding("Expanded");
            bind.Mode = BindingMode.TwoWay;

            SimpleExpander expander = new SimpleExpander();
            expander.Visibility = (node.ChildNodes.Count == 0) ? Visibility.Collapsed : Visibility.Visible;
            expander.IsExpandedChanged += new EventHandler(expander_IsExpandedChanged);
            expander.SetBinding(SimpleExpander.IsExpandedProperty, bind);

            panel.Children.Add(b);
            panel.Children.Add(expander);

            return panel;
        }