/// <summary>
        /// Layout the content of the window.
        /// </summary>
        private void LayoutDesign()
        {
            //Set up the grid.
            Grid grid = new Grid();
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            //Create the width characteritic label and inputs
            StackPanel widthPanel = new StackPanel() { Orientation = Orientation.Horizontal };
            widthPanel.Margin = new Thickness(0, 0, 0, 10);
            TextBlock label = new TextBlock();
            label.Text = "Width:";
            label.Margin = new Thickness(0, 0, 10, 0);
            label.VerticalAlignment = VerticalAlignment.Center;
            label.Width = 45;
            widthPanel.Children.Add(label);
            minWidth = new NumericTextBox();
            minWidth.Width = 75;
            minWidth.Margin = new Thickness(0, 0, 10, 0);
            widthPanel.Children.Add(minWidth);
            maxWidth = new NumericTextBox();
            maxWidth.Width = 75;
            widthPanel.Children.Add(maxWidth);

            //Create the length characteritic label and inputs
            StackPanel lengthPanel = new StackPanel() { Orientation = Orientation.Horizontal };
            lengthPanel.Margin = new Thickness(0, 0, 0, 10);
            label = new TextBlock();
            label.Text = "Length:";
            label.Margin = new Thickness(0, 0, 10, 0);
            label.VerticalAlignment = VerticalAlignment.Center;
            label.Width = 45;
            lengthPanel.Children.Add(label);
            minLength = new NumericTextBox();
            minLength.Width = 75;
            minLength.Margin = new Thickness(0, 0, 10, 0);
            lengthPanel.Children.Add(minLength);
            maxLength = new NumericTextBox();
            maxLength.Width = 75;
            lengthPanel.Children.Add(maxLength);

            //Create a label and list of given relationships
            StackPanel givenPanel = new StackPanel();
            givenPanel.Margin = new Thickness(0, 0, 10, 0);
            label = new TextBlock();
            label.Text = "Given:";
            givenPanel.Children.Add(label);
            ListBox givenList = new ListBox();
            givenList.MinWidth = 200;
            givenList.MaxWidth = 200;
            givenList.MinHeight = 300;
            givenList.MaxHeight = 300;
            givenList.ItemsSource = givenCheckboxes.Values;
            givenPanel.Children.Add(givenList);

            //Create a label and list of goal relationships
            StackPanel goalPanel = new StackPanel();
            label = new TextBlock();
            label.Text = "Goal:";
            goalPanel.Children.Add(label);
            ListBox goalList = new ListBox();
            goalList.MinWidth = 200;
            goalList.MaxWidth = 200;
            goalList.MinHeight = 300;
            goalList.MaxHeight = 300;
            goalList.ItemsSource = goalCheckboxes.Values;
            goalPanel.Children.Add(goalList);

            //Create button to manage givens
            Button openGivensWindow = new Button();
            openGivensWindow.Content = "Manage Problem Givens";
            openGivensWindow.HorizontalAlignment = HorizontalAlignment.Center;
            openGivensWindow.Margin = new Thickness(0, 10, 0, 0);
            openGivensWindow.Click += new RoutedEventHandler(ManageGivens_Open);

            //Arrange items in the grid and add them to the grid.
            Grid.SetColumn(widthPanel, 0);
            Grid.SetRow(widthPanel, 0);
            Grid.SetColumnSpan(widthPanel, 2);
            grid.Children.Add(widthPanel);
            Grid.SetColumn(lengthPanel, 0);
            Grid.SetRow(lengthPanel, 1);
            Grid.SetColumnSpan(lengthPanel, 2);
            grid.Children.Add(lengthPanel);
            Grid.SetColumn(givenPanel, 0);
            Grid.SetRow(givenPanel, 2);
            grid.Children.Add(givenPanel);
            Grid.SetColumn(goalPanel, 1);
            Grid.SetRow(goalPanel, 2);
            grid.Children.Add(goalPanel);
            Grid.SetColumn(openGivensWindow, 0);
            Grid.SetRow(openGivensWindow, 3);
            Grid.SetColumnSpan(openGivensWindow, 2);
            grid.Children.Add(openGivensWindow);

            //Set the grid as the content of the window in order to display it.
            this.Content = grid;
        }
Пример #2
0
            public EntryPanel(ShapeType shapeType, string description)
                : base()
            {
                //StackPanel settings
                Orientation = Orientation.Horizontal;
                HorizontalAlignment = HorizontalAlignment.Right;

                //Save input parameter
                ShapeType = shapeType;

                //Make the description box
                Description = new TextBlock();
                Description.Text = description;
                Description.Margin = new Thickness(0, 0, 5, 0);
                Description.VerticalAlignment = VerticalAlignment.Center;
                Children.Add(Description);

                //Make the numeric entry box
                EntryBox = new NumericTextBox();
                EntryBox.Width = 30;
                Children.Add(EntryBox);
            }
        /// <summary>
        /// Layout the content of the window.
        /// </summary>
        private void LayoutDesign()
        {
            //Set up the grid.
            Grid grid = new Grid();

            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });

            //Create the width characteritic label and inputs
            StackPanel widthPanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            widthPanel.Margin = new Thickness(0, 0, 0, 10);
            TextBlock label = new TextBlock();

            label.Text              = "Width:";
            label.Margin            = new Thickness(0, 0, 10, 0);
            label.VerticalAlignment = VerticalAlignment.Center;
            label.Width             = 45;
            widthPanel.Children.Add(label);
            minWidth        = new NumericTextBox();
            minWidth.Width  = 75;
            minWidth.Margin = new Thickness(0, 0, 10, 0);
            widthPanel.Children.Add(minWidth);
            maxWidth       = new NumericTextBox();
            maxWidth.Width = 75;
            widthPanel.Children.Add(maxWidth);

            //Create the length characteritic label and inputs
            StackPanel lengthPanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            lengthPanel.Margin = new Thickness(0, 0, 0, 10);
            label                   = new TextBlock();
            label.Text              = "Length:";
            label.Margin            = new Thickness(0, 0, 10, 0);
            label.VerticalAlignment = VerticalAlignment.Center;
            label.Width             = 45;
            lengthPanel.Children.Add(label);
            minLength        = new NumericTextBox();
            minLength.Width  = 75;
            minLength.Margin = new Thickness(0, 0, 10, 0);
            lengthPanel.Children.Add(minLength);
            maxLength       = new NumericTextBox();
            maxLength.Width = 75;
            lengthPanel.Children.Add(maxLength);

            //Create a label and list of given relationships
            StackPanel givenPanel = new StackPanel();

            givenPanel.Margin = new Thickness(0, 0, 10, 0);
            label             = new TextBlock();
            label.Text        = "Given:";
            givenPanel.Children.Add(label);
            ListBox givenList = new ListBox();

            givenList.MinWidth    = 200;
            givenList.MaxWidth    = 200;
            givenList.MinHeight   = 300;
            givenList.MaxHeight   = 300;
            givenList.ItemsSource = givenCheckboxes.Values;
            givenPanel.Children.Add(givenList);

            //Create a label and list of goal relationships
            StackPanel goalPanel = new StackPanel();

            label      = new TextBlock();
            label.Text = "Goal:";
            goalPanel.Children.Add(label);
            ListBox goalList = new ListBox();

            goalList.MinWidth    = 200;
            goalList.MaxWidth    = 200;
            goalList.MinHeight   = 300;
            goalList.MaxHeight   = 300;
            goalList.ItemsSource = goalCheckboxes.Values;
            goalPanel.Children.Add(goalList);

            //Create button to manage givens
            Button openGivensWindow = new Button();

            openGivensWindow.Content             = "Manage Problem Givens";
            openGivensWindow.HorizontalAlignment = HorizontalAlignment.Center;
            openGivensWindow.Margin = new Thickness(0, 10, 0, 0);
            openGivensWindow.Click += new RoutedEventHandler(ManageGivens_Open);

            //Arrange items in the grid and add them to the grid.
            Grid.SetColumn(widthPanel, 0);
            Grid.SetRow(widthPanel, 0);
            Grid.SetColumnSpan(widthPanel, 2);
            grid.Children.Add(widthPanel);
            Grid.SetColumn(lengthPanel, 0);
            Grid.SetRow(lengthPanel, 1);
            Grid.SetColumnSpan(lengthPanel, 2);
            grid.Children.Add(lengthPanel);
            Grid.SetColumn(givenPanel, 0);
            Grid.SetRow(givenPanel, 2);
            grid.Children.Add(givenPanel);
            Grid.SetColumn(goalPanel, 1);
            Grid.SetRow(goalPanel, 2);
            grid.Children.Add(goalPanel);
            Grid.SetColumn(openGivensWindow, 0);
            Grid.SetRow(openGivensWindow, 3);
            Grid.SetColumnSpan(openGivensWindow, 2);
            grid.Children.Add(openGivensWindow);

            //Set the grid as the content of the window in order to display it.
            this.Content = grid;
        }