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);
        }
        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;
        }