Beispiel #1
0
        /// <summary>
        /// Generates a DockPanel that contains the controls specific to this editor mode.
        /// </summary>
        private DockPanel CreateUI()
        {
            DockPanel actor_dock_panel = new DockPanel();

            WDetailsView actor_details = new WDetailsView()
            {
                Name        = "Details",
                DataContext = DetailsViewModel
            };

            GroupBox actor_prop_box = new GroupBox()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                Header  = "Properties",
                Content = actor_details
            };

            DockPanel.SetDock(actor_prop_box, Dock.Top);

            actor_dock_panel.Children.Add(actor_prop_box);

            return(actor_dock_panel);
        }
        private DockPanel CreateUI()
        {
            DockPanel collision_dock_panel = new DockPanel()
            {
                LastChildFill = true
            };

            StackPanel collision_stack_panel = new StackPanel()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
            };

            RowDefinition tree_row       = new RowDefinition();
            RowDefinition splitter_row   = new RowDefinition();
            RowDefinition properties_row = new RowDefinition();

            tree_row.Height          = System.Windows.GridLength.Auto;
            tree_row.MaxHeight       = 500;
            tree_row.MinHeight       = 10;
            splitter_row.Height      = System.Windows.GridLength.Auto;
            properties_row.Height    = System.Windows.GridLength.Auto;
            properties_row.MinHeight = 80;

            Grid col_grid = new Grid();

            col_grid.RowDefinitions.Add(tree_row);
            col_grid.RowDefinitions.Add(splitter_row);
            col_grid.RowDefinitions.Add(properties_row);

            System.Windows.HierarchicalDataTemplate template = new System.Windows.HierarchicalDataTemplate(typeof(CollisionGroupNode));
            template.ItemsSource = new Binding("Children");

            System.Windows.FrameworkElementFactory tb = new System.Windows.FrameworkElementFactory(typeof(TextBlock));
            tb.SetBinding(TextBlock.TextProperty, new Binding("Name"));
            tb.SetValue(TextBlock.ForegroundProperty, Brushes.Black);

            template.VisualTree = tb;

            m_CollisionTree = new TreeView()
            {
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                ItemTemplate        = template
            };
            m_CollisionTree.SelectedItemChanged        += M_test_tree_SelectedItemChanged;
            m_CollisionTree.PreviewMouseLeftButtonDown += OnItemMouseDoubleClick;

            Grid.SetRow(m_CollisionTree, 0);

            GridSplitter splitter = new GridSplitter()
            {
                Height              = 5,
                VerticalAlignment   = System.Windows.VerticalAlignment.Top,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch
            };

            Grid.SetRow(splitter, 1);

            WDetailsView actor_details = new WDetailsView()
            {
                Name = "Details",
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                DataContext         = DetailsViewModel
            };

            GroupBox actor_prop_box = new GroupBox()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                Header  = "Properties",
                Content = actor_details,
            };

            Grid.SetRow(actor_prop_box, 2);

            col_grid.Children.Add(m_CollisionTree);
            col_grid.Children.Add(splitter);
            col_grid.Children.Add(actor_prop_box);

            DockPanel.SetDock(collision_stack_panel, Dock.Top);

            collision_stack_panel.Children.Add(col_grid);
            collision_dock_panel.Children.Add(collision_stack_panel);

            return(collision_dock_panel);
        }
Beispiel #3
0
        /// <summary>
        /// Generates a DockPanel that contains the controls specific to this editor mode.
        /// </summary>
        private DockPanel CreateUI()
        {
            DockPanel event_dock_panel = new DockPanel()
            {
                LastChildFill = true
            };

            StackPanel event_stack_panel = new StackPanel()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
            };

            RowDefinition combo_row      = new RowDefinition();
            RowDefinition buttons_row    = new RowDefinition();
            RowDefinition properties_row = new RowDefinition();

            ColumnDefinition col_A = new ColumnDefinition();
            ColumnDefinition col_B = new ColumnDefinition();

            combo_row.Height      = System.Windows.GridLength.Auto;
            combo_row.MaxHeight   = 500;
            combo_row.MinHeight   = 10;
            buttons_row.MaxHeight = 300;
            buttons_row.MinHeight = 10;
            properties_row.Height = System.Windows.GridLength.Auto;
            //properties_row.MinHeight = 80;

            Grid ev_grid = new Grid();

            ev_grid.RowDefinitions.Add(combo_row);
            ev_grid.RowDefinitions.Add(buttons_row);
            ev_grid.RowDefinitions.Add(properties_row);
            ev_grid.ColumnDefinitions.Add(col_A);
            ev_grid.ColumnDefinitions.Add(col_B);

            m_EventCombo = new ComboBox()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                DisplayMemberPath   = "Name",
                Margin = new System.Windows.Thickness(5)
            };

            m_EventCombo.SelectionChanged += OnEventSelectionChanged;

            Grid.SetRow(m_EventCombo, 0);
            Grid.SetColumnSpan(m_EventCombo, 2);

            Button add_event = new Button()
            {
                Content = "Add", Command = CreateEventCommand, Height = 25, Margin = new System.Windows.Thickness(5)
            };
            Button remove_event = new Button()
            {
                Content = "Remove", Command = RemoveEventCommand, Height = 25, Margin = new System.Windows.Thickness(5)
            };

            Grid.SetRow(add_event, 1);
            Grid.SetColumn(add_event, 0);
            Grid.SetRow(remove_event, 1);
            Grid.SetColumn(remove_event, 1);

            WDetailsView actor_details = new WDetailsView()
            {
                Name = "Details",
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                DataContext         = EventDetailsViewModel
            };

            GroupBox actor_prop_box = new GroupBox()
            {
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                Header  = "Properties",
                Content = actor_details,
            };

            Grid.SetRow(actor_prop_box, 2);
            Grid.SetColumnSpan(actor_prop_box, 2);

            ev_grid.Children.Add(m_EventCombo);
            ev_grid.Children.Add(add_event);
            ev_grid.Children.Add(remove_event);
            ev_grid.Children.Add(actor_prop_box);

            DockPanel.SetDock(event_stack_panel, Dock.Top);

            event_stack_panel.Children.Add(ev_grid);
            event_dock_panel.Children.Add(event_stack_panel);

            return(event_dock_panel);
        }