示例#1
0
        public NormalUIScreen(IUIRenderer renderer)
            : base("Normal", renderer)
        {
            Image = new Image
            {
                Width  = 800,
                Height = 450,
            };

            _window = new Window
            {
                X                = 100,
                Y                = 50,
                Title            = "3D Scene (Click scene to control camera. Press <Esc> to leave scene.)",
                CanResize        = true,
                CloseButtonStyle = null, // Hide close button.
                Content          = new ScrollViewer
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    Content             = Image
                },
            };
            _window.Show(this);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UIScreen"/> class.
        /// </summary>
        /// <param name="name">The name of the screen.</param>
        /// <param name="renderer">
        /// The renderer that defines the styles and visual appearance for controls in this screen.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="name"/> or <paramref name="renderer"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="name"/> is an empty string.
        /// </exception>
        public UIScreen(string name, IUIRenderer renderer)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (name.Length == 0)
            {
                throw new ArgumentException("String is empty.", "name");
            }
            if (renderer == null)
            {
                throw new ArgumentNullException("renderer");
            }

            Name     = name;
            Renderer = renderer;

            Style = "UIScreen";

            Children = new NotifyingCollection <UIControl>(false, false);
            Children.CollectionChanged += OnChildrenChanged;

            _focusManager  = new FocusManager(this);
            ToolTipManager = new ToolTipManager(this);

#if !SILVERLIGHT
            // Call OnVisibleChanged when IsVisible changes.
            var isVisible = Properties.Get <bool>(IsVisiblePropertyId);
            isVisible.Changed += (s, e) => OnVisibleChanged(EventArgs.Empty);
#endif

            InputEnabled = true;
        }
示例#3
0
    public NormalUIScreen(IUIRenderer renderer)
      : base("Normal", renderer)
    {
      Image = new Image
      {
        Width = 800,
        Height = 450,
      };

      _window = new Window
      {
        X = 100,
        Y = 50,
        Title = "3D Scene (Click scene to control camera. Press <Esc> to leave scene.)",
        CanResize = true,
        CloseButtonStyle = null,     // Hide close button.
        Content = new ScrollViewer
        {
          HorizontalAlignment = HorizontalAlignment.Stretch,
          VerticalAlignment = VerticalAlignment.Stretch,
          Content = Image
        },
      };
      _window.Show(this);
    }
            public void AddToTemplate(IUIRenderer renderer, string style, GameObject template)
            {
                // Add this property to the game object. The value is set to:
                // - the value of the Renderer/Theme, or
                // - the overridden default value, or
                // - no value (= the global default value of the GamePropertyMetadata).

                T value;

                if (renderer.GetAttribute(style, Name, out value))
                {
                    // Set value from renderer/theme.
                    template.SetValue(Name, value);
                }
                else if (OverridesDefaultValue)
                {
                    // Set overridden default value.
                    template.SetValue(Name, DefaultValue);
                }
                else
                {
                    // Use default value. (Add property without local value.)
                    template.Properties.Add <T>(Name);
                }
            }
示例#5
0
    public InGameUIScreen(IServiceLocator services, IUIRenderer renderer)
      : base("InGame", renderer)
    {
      var gameObjectService = services.GetInstance<IGameObjectService>();
      _cameraObject = (CameraObject)gameObjectService.Objects["Camera"];

      _simulation = services.GetInstance<Simulation>();

      Background = Color.White;

      // Add one window to the screen.
      Window window = new InGameWindow(services) { X = 175, Y = 30 };
      window.Show(this);
    }
示例#6
0
        public InGameUIScreen(IServiceLocator services, IUIRenderer renderer)
            : base("InGame", renderer)
        {
            var gameObjectService = services.GetInstance <IGameObjectService>();

            _cameraObject = (CameraObject)gameObjectService.Objects["Camera"];

            _simulation = services.GetInstance <Simulation>();

            Background = Color.White;

            // Add one window to the screen.
            Window window = new InGameWindow(services)
            {
                X = 175, Y = 30
            };

            window.Show(this);
        }
示例#7
0
        public AllControlsWindow(ContentManager content, IUIRenderer renderer)
        {
            Title     = "All Controls (This window has a context menu!)";
            CanResize = false;

            // The window content is set to a horizontal stack panel that contains two vertical
            // stack panels. The controls are added to the vertical panels.

            // ----- Button with text content
            var button0 = new Button
            {
                Content = new TextBlock {
                    Text = "Button"
                },
                Margin = new Vector4(4),
            };

            // ----- Button with mixed content
            // The content of a button is usually a text block but can be any UI control.
            // Let's try a button with image + text.
            var buttonContentPanel = new StackPanel {
                Orientation = Orientation.Horizontal
            };

            buttonContentPanel.Children.Add(new Image
            {
                Width   = 16,
                Height  = 16,
                Texture = content.Load <Texture2D>("Icon")
            });

            buttonContentPanel.Children.Add(new TextBlock
            {
                Margin            = new Vector4(4, 0, 0, 0),
                Text              = "Button with image",
                VerticalAlignment = VerticalAlignment.Center,
            });

            var button1 = new Button
            {
                Content = buttonContentPanel,
                Margin  = new Vector4(4),
            };

            // ----- Drop-down button
            var dropDown = new DropDownButton
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin            = new Vector4(4),
                MaxDropDownHeight = 250,
            };

            for (int i = 0; i < 20; i++)
            {
                dropDown.Items.Add("DropDownItem " + i);
            }
            dropDown.SelectedIndex = 0;

            // ----- Check box
            var checkBox = new CheckBox
            {
                Margin  = new Vector4(4),
                Content = new TextBlock {
                    Text = "CheckBox"
                },
            };

            // ----- Group of radio buttons
            var radioButton0 = new RadioButton
            {
                Margin  = new Vector4(4, 8, 4, 4),
                Content = new TextBlock {
                    Text = "RadioButton0"
                },
            };

            var radioButton1 = new RadioButton
            {
                Margin  = new Vector4(4, 2, 4, 2),
                Content = new TextBlock {
                    Text = "RadioButton1"
                },
            };

            var radioButton2 = new RadioButton
            {
                Margin  = new Vector4(4, 2, 4, 4),
                Content = new TextBlock {
                    Text = "RadioButton1"
                },
            };

            // ----- Progress bar with value
            var progressBar0 = new ProgressBar
            {
                IsIndeterminate     = false,
                Value               = 75,
                Margin              = new Vector4(4, 8, 4, 4),
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Cursor              = renderer.GetCursor("Wait"),
            };

            // ----- Progress bar without value (indeterminate)
            var progressBar1 = new ProgressBar
            {
                IsIndeterminate     = true,
                Margin              = new Vector4(4),
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Cursor              = renderer.GetCursor("Wait"),
            };

            // ----- Slider connected with a text box.
            var slider = new Slider
            {
                Value  = 60,
                Margin = new Vector4(4),
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            var sliderValue = new TextBlock
            {
                Margin = new Vector4(4, 0, 4, 4),
                Text   = "(Value = 60)",
                HorizontalAlignment = HorizontalAlignment.Right
            };

            // To connect the slider with the text box, we need to get the "Value" property.
            var valueProperty = slider.Properties.Get <float>("Value");

            // This property is a GameObjectProperty<float>. We can attach an event handler to
            // the Changed event of the property.
            valueProperty.Changed += (s, e) => sliderValue.Text = "(Value = " + (int)e.NewValue + ")";

            // ----- Scroll bar
            var scrollBar = new ScrollBar
            {
                Style               = "ScrollBarHorizontal",
                SmallChange         = 1,
                LargeChange         = 10,
                Value               = 45,
                ViewportSize        = 0.3f,
                Margin              = new Vector4(4),
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            // Add the controls to the first vertical stack panel.
            var stackPanel0 = new StackPanel
            {
                Margin = new Vector4(4),
            };

            stackPanel0.Children.Add(button0);
            stackPanel0.Children.Add(button1);
            stackPanel0.Children.Add(dropDown);
            stackPanel0.Children.Add(checkBox);
            stackPanel0.Children.Add(radioButton0);
            stackPanel0.Children.Add(radioButton1);
            stackPanel0.Children.Add(radioButton2);
            stackPanel0.Children.Add(progressBar0);
            stackPanel0.Children.Add(progressBar1);
            stackPanel0.Children.Add(slider);
            stackPanel0.Children.Add(sliderValue);
            stackPanel0.Children.Add(scrollBar);

            // ----- Group box
            var groupBox = new GroupBox
            {
                Title = "GroupBox",
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin  = new Vector4(4),
                Content = new TextBlock
                {
                    Margin = new Vector4(4),
                    Text   = "GroupBox Content"
                }
            };

            // ----- Tab control with 3 tab items
            var tabItem0 = new TabItem
            {
                TabPage = new TextBlock {
                    Margin = new Vector4(4), Text = "Page 0"
                },
                Content = new TextBlock {
                    Text = "Item 0"
                },
            };
            var tabItem1 = new TabItem
            {
                TabPage = new TextBlock {
                    Margin = new Vector4(4), Text = "Page 1"
                },
                Content = new TextBlock {
                    Text = "Item 1"
                },
            };
            var tabItem2 = new TabItem
            {
                TabPage = new TextBlock {
                    Margin = new Vector4(4), Text = "Page 2"
                },
                Content = new TextBlock {
                    Text = "Item 2"
                },
            };
            var tabControl = new TabControl
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Vector4(4),
            };

            tabControl.Items.Add(tabItem0);
            tabControl.Items.Add(tabItem1);
            tabControl.Items.Add(tabItem2);

            // ----- Scroll viewer showing an image
            var image = new Image
            {
                Texture = content.Load <Texture2D>("Sky"),
            };

            var scrollViewer = new ScrollViewer
            {
                Margin = new Vector4(4),
                HorizontalAlignment = HorizontalAlignment.Stretch,
                MinHeight           = 100,
                HorizontalOffset    = 200,
                VerticalOffset      = 200,
                Height = 200,
            };

            scrollViewer.Content = image;

            // ----- Text box
            var textBox0 = new TextBox
            {
                Margin              = new Vector4(4),
                Text                = "The quick brown fox jumps over the lazy dog.",
                MaxLines            = 1,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            // ----- Password box
            var textBox1 = new TextBox
            {
                Margin              = new Vector4(4),
                Text                = "Secret password!",
                MaxLines            = 1,
                IsPassword          = true,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            // ----- Multi-line text box
            var textBox2 = new TextBox
            {
                Margin = new Vector4(4),
                Text   = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifend, nulla semper vestibulum congue, lectus lectus aliquam magna, lobortis luctus sem magna sit amet elit. Integer at neque nec mi dapibus tincidunt. Maecenas elit quam, varius luctus rutrum ut, congue quis libero. In hac habitasse platea dictumst. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus eu ante eros. Etiam odio lectus, sagittis non dictum eu, faucibus vitae magna. Maecenas mi lorem, semper vel condimentum sit amet, vehicula quis nulla. Cras suscipit scelerisque orci, ac ullamcorper lorem egestas sed. Nulla facilisi. Nam justo enim, mollis nec condimentum non, consectetur vel purus. Curabitur ac diam vitae justo ultricies auctor.\n"
                         + "Pellentesque interdum vehicula nisi sed congue. Etiam eget magna nec metus suscipit tincidunt et in lectus. Praesent sapien tortor, congue et semper eu, mattis ac lorem. Duis id est et justo tempus consectetur. Aliquam rutrum ullamcorper augue non varius. Fusce ornare lectus et ipsum lobortis ut venenatis tellus sodales. Proin venenatis scelerisque dui eu viverra. Pellentesque vitae risus eget tellus vehicula molestie et quis ante. Nulla imperdiet rhoncus ante, eu tristique ante euismod id. Sed varius varius hendrerit. Praesent massa tortor, gravida suscipit lacinia non, suscipit a ipsum. Integer vulputate, felis vitae consectetur bibendum, ante velit tincidunt nunc, in convallis erat dolor eu purus.",
                MinLines            = 5,
                MaxLines            = 5,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            // ----- Console (command prompt)
            var console = new Console
            {
                Margin = new Vector4(4),
                HorizontalAlignment = HorizontalAlignment.Stretch,
                MinHeight           = 100,
            };

            // Add the controls to the second vertical stack panel.
            var stackPanel1 = new StackPanel
            {
                Width  = 250,
                Margin = new Vector4(4),
            };

            stackPanel1.Children.Add(groupBox);
            stackPanel1.Children.Add(tabControl);
            stackPanel1.Children.Add(scrollViewer);
            stackPanel1.Children.Add(textBox0);
            stackPanel1.Children.Add(textBox1);
            stackPanel1.Children.Add(textBox2);
            stackPanel1.Children.Add(console);

            // Add the two vertical stack panel into a horizontal stack panel.
            var stackPanelHorizontal = new StackPanel
            {
                Orientation = Orientation.Horizontal
            };

            stackPanelHorizontal.Children.Add(stackPanel0);
            stackPanelHorizontal.Children.Add(stackPanel1);

            Content = stackPanelHorizontal;

            // ----- Add a context menu to the window. (Each UI control can have its own context menu.)
            ContextMenu = new ContextMenu();

            // Add menu items.
            for (int i = 0; i < 10; i++)
            {
                var menuItem = new MenuItem
                {
                    Content = new TextBlock {
                        Text = "MenuItem" + i
                    },
                };
                ContextMenu.Items.Add(menuItem);
            }
        }
示例#8
0
    /// <summary>
    /// Initializes a new instance of the <see cref="UIScreen"/> class.
    /// </summary>
    /// <param name="name">The name of the screen.</param>
    /// <param name="renderer">
    /// The renderer that defines the styles and visual appearance for controls in this screen. 
    /// </param>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="name"/> or <paramref name="renderer"/> is <see langword="null"/>.
    /// </exception>
    /// <exception cref="ArgumentException">
    /// <paramref name="name"/> is an empty string.
    /// </exception>
    public UIScreen(string name, IUIRenderer renderer)
    {
      if (name == null)
        throw new ArgumentNullException("name");
      if (name.Length == 0)
        throw new ArgumentException("String is empty.", "name");
      if (renderer == null)
        throw new ArgumentNullException("renderer");

      Name = name;
      Renderer = renderer;

      Style = "UIScreen";

      Children = new NotifyingCollection<UIControl>(false, false);
      Children.CollectionChanged += OnChildrenChanged;

      _focusManager = new FocusManager(this);
      ToolTipManager = new ToolTipManager(this);

#if !SILVERLIGHT
      // Call OnVisibleChanged when IsVisible changes.
      var isVisible = Properties.Get<bool>(IsVisiblePropertyId);
      isVisible.Changed += (s, e) => OnVisibleChanged(EventArgs.Empty);
#endif

      InputEnabled = true;
    }
示例#9
0
    public AllControlsWindow(ContentManager content, IUIRenderer renderer)
    {
      Title = "All Controls (This window has a context menu!)";
      CanResize = false;

      // The window content is set to a horizontal stack panel that contains two vertical
      // stack panels. The controls are added to the vertical panels.

      // ----- Button with text content
      var button0 = new Button
      {
        Content = new TextBlock { Text = "Button" },
        Margin = new Vector4F(4),
      };

      // ----- Button with mixed content
      // The content of a button is usually a text block but can be any UI control.
      // Let's try a button with image + text.
      var buttonContentPanel = new StackPanel { Orientation = Orientation.Horizontal };
      buttonContentPanel.Children.Add(new Image
      {
        Width = 16,
        Height = 16,
        Texture = content.Load<Texture2D>("Icon")
      });

      buttonContentPanel.Children.Add(new TextBlock
      {
        Margin = new Vector4F(4, 0, 0, 0),
        Text = "Button with image",
        VerticalAlignment = VerticalAlignment.Center,
      });

      var button1 = new Button
      {
        Content = buttonContentPanel,
        Margin = new Vector4F(4),
      };

      // ----- Drop-down button
      var dropDown = new DropDownButton
      {
        HorizontalAlignment = HorizontalAlignment.Stretch,
        Margin = new Vector4F(4),
        MaxDropDownHeight = 250,
      };
      for (int i = 0; i < 20; i++)
      {
        dropDown.Items.Add("DropDownItem " + i);
      }
      dropDown.SelectedIndex = 0;

      // ----- Check box
      var checkBox = new CheckBox
      {
        Margin = new Vector4F(4),
        Content = new TextBlock { Text = "CheckBox" },
      };

      // ----- Group of radio buttons
      var radioButton0 = new RadioButton
      {
        Margin = new Vector4F(4, 8, 4, 4),
        Content = new TextBlock { Text = "RadioButton0" },
      };

      var radioButton1 = new RadioButton
      {
        Margin = new Vector4F(4, 2, 4, 2),
        Content = new TextBlock { Text = "RadioButton1" },
      };

      var radioButton2 = new RadioButton
      {
        Margin = new Vector4F(4, 2, 4, 4),
        Content = new TextBlock { Text = "RadioButton1" },
      };

      // ----- Progress bar with value
      var progressBar0 = new ProgressBar
      {
        IsIndeterminate = false,
        Value = 75,
        Margin = new Vector4F(4, 8, 4, 4),
        HorizontalAlignment = HorizontalAlignment.Stretch,
        Cursor = renderer.GetCursor("Wait"),
      };

      // ----- Progress bar without value (indeterminate)
      var progressBar1 = new ProgressBar
      {
        IsIndeterminate = true,
        Margin = new Vector4F(4),
        HorizontalAlignment = HorizontalAlignment.Stretch,
        Cursor = renderer.GetCursor("Wait"),
      };

      // ----- Slider connected with a text box.
      var slider = new Slider
      {
        Value = 60,
        Margin = new Vector4F(4),
        HorizontalAlignment = HorizontalAlignment.Stretch,
      };

      var sliderValue = new TextBlock
      {
        Margin = new Vector4F(4, 0, 4, 4),
        Text = "(Value = 60)",
        HorizontalAlignment = HorizontalAlignment.Right
      };

      // To connect the slider with the text box, we need to get the "Value" property.
      var valueProperty = slider.Properties.Get<float>("Value");
      // This property is a GameObjectProperty<float>. We can attach an event handler to 
      // the Changed event of the property.
      valueProperty.Changed += (s, e) => sliderValue.Text = "(Value = " + (int)e.NewValue + ")";

      // ----- Scroll bar
      var scrollBar = new ScrollBar
      {
        Style = "ScrollBarHorizontal",
        SmallChange = 1,
        LargeChange = 10,
        Value = 45,
        ViewportSize = 0.3f,
        Margin = new Vector4F(4),
        HorizontalAlignment = HorizontalAlignment.Stretch,
      };

      // Add the controls to the first vertical stack panel.
      var stackPanel0 = new StackPanel
      {
        Margin = new Vector4F(4),
      };
      stackPanel0.Children.Add(button0);
      stackPanel0.Children.Add(button1);
      stackPanel0.Children.Add(dropDown);
      stackPanel0.Children.Add(checkBox);
      stackPanel0.Children.Add(radioButton0);
      stackPanel0.Children.Add(radioButton1);
      stackPanel0.Children.Add(radioButton2);
      stackPanel0.Children.Add(progressBar0);
      stackPanel0.Children.Add(progressBar1);
      stackPanel0.Children.Add(slider);
      stackPanel0.Children.Add(sliderValue);
      stackPanel0.Children.Add(scrollBar);

      // ----- Group box
      var groupBox = new GroupBox
      {
        Title = "GroupBox",
        HorizontalAlignment = HorizontalAlignment.Stretch,
        Margin = new Vector4F(4),
        Content = new TextBlock
        {
          Margin = new Vector4F(4),
          Text = "GroupBox Content"
        }
      };

      // ----- Tab control with 3 tab items
      var tabItem0 = new TabItem
      {
        TabPage = new TextBlock { Margin = new Vector4F(4), Text = "Page 0" },
        Content = new TextBlock { Text = "Item 0" },
      };
      var tabItem1 = new TabItem
      {
        TabPage = new TextBlock { Margin = new Vector4F(4), Text = "Page 1" },
        Content = new TextBlock { Text = "Item 1" },
      };
      var tabItem2 = new TabItem
      {
        TabPage = new TextBlock { Margin = new Vector4F(4), Text = "Page 2" },
        Content = new TextBlock { Text = "Item 2" },
      };
      var tabControl = new TabControl
      {
        HorizontalAlignment = HorizontalAlignment.Stretch,
        Margin = new Vector4F(4),
      };
      tabControl.Items.Add(tabItem0);
      tabControl.Items.Add(tabItem1);
      tabControl.Items.Add(tabItem2);

      // ----- Scroll viewer showing an image
      var image = new Image
      {
        Texture = content.Load<Texture2D>("Sky"),
      };

      var scrollViewer = new ScrollViewer
      {
        Margin = new Vector4F(4),
        HorizontalAlignment = HorizontalAlignment.Stretch,
        MinHeight = 100,
        HorizontalOffset = 200,
        VerticalOffset = 200,
        Height = 200,
      };
      scrollViewer.Content = image;

      // ----- Text box
      var textBox0 = new TextBox
      {
        Margin = new Vector4F(4),
        Text = "The quick brown fox jumps over the lazy dog.",
        MaxLines = 1,
        HorizontalAlignment = HorizontalAlignment.Stretch,
      };

      // ----- Password box
      var textBox1 = new TextBox
      {
        Margin = new Vector4F(4),
        Text = "Secret password!",
        MaxLines = 1,
        IsPassword = true,
        HorizontalAlignment = HorizontalAlignment.Stretch,
      };

      // ----- Multi-line text box
      var textBox2 = new TextBox
      {
        Margin = new Vector4F(4),
        Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifend, nulla semper vestibulum congue, lectus lectus aliquam magna, lobortis luctus sem magna sit amet elit. Integer at neque nec mi dapibus tincidunt. Maecenas elit quam, varius luctus rutrum ut, congue quis libero. In hac habitasse platea dictumst. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus eu ante eros. Etiam odio lectus, sagittis non dictum eu, faucibus vitae magna. Maecenas mi lorem, semper vel condimentum sit amet, vehicula quis nulla. Cras suscipit scelerisque orci, ac ullamcorper lorem egestas sed. Nulla facilisi. Nam justo enim, mollis nec condimentum non, consectetur vel purus. Curabitur ac diam vitae justo ultricies auctor.\n"
             + "Pellentesque interdum vehicula nisi sed congue. Etiam eget magna nec metus suscipit tincidunt et in lectus. Praesent sapien tortor, congue et semper eu, mattis ac lorem. Duis id est et justo tempus consectetur. Aliquam rutrum ullamcorper augue non varius. Fusce ornare lectus et ipsum lobortis ut venenatis tellus sodales. Proin venenatis scelerisque dui eu viverra. Pellentesque vitae risus eget tellus vehicula molestie et quis ante. Nulla imperdiet rhoncus ante, eu tristique ante euismod id. Sed varius varius hendrerit. Praesent massa tortor, gravida suscipit lacinia non, suscipit a ipsum. Integer vulputate, felis vitae consectetur bibendum, ante velit tincidunt nunc, in convallis erat dolor eu purus.",
        MinLines = 5,
        MaxLines = 5,
        HorizontalAlignment = HorizontalAlignment.Stretch,
      };

      // ----- Console (command prompt)
      var console = new Console
      {
        Margin = new Vector4F(4),
        HorizontalAlignment = HorizontalAlignment.Stretch,
        MinHeight = 100,
      };

      // Add the controls to the second vertical stack panel.
      var stackPanel1 = new StackPanel
      {
        Width = 250,
        Margin = new Vector4F(4),
      };
      stackPanel1.Children.Add(groupBox);
      stackPanel1.Children.Add(tabControl);
      stackPanel1.Children.Add(scrollViewer);
      stackPanel1.Children.Add(textBox0);
      stackPanel1.Children.Add(textBox1);
      stackPanel1.Children.Add(textBox2);
      stackPanel1.Children.Add(console);

      // Add the two vertical stack panel into a horizontal stack panel.
      var stackPanelHorizontal = new StackPanel
      {
        Orientation = Orientation.Horizontal
      };
      stackPanelHorizontal.Children.Add(stackPanel0);
      stackPanelHorizontal.Children.Add(stackPanel1);

      Content = stackPanelHorizontal;

      // ----- Add a context menu to the window. (Each UI control can have its own context menu.)
      ContextMenu = new ContextMenu();

      // Add menu items.
      for (int i = 0; i < 10; i++)
      {
        var menuItem = new MenuItem
        {
          Content = new TextBlock { Text = "MenuItem" + i },
        };
        ContextMenu.Items.Add(menuItem);
      }
    }
示例#10
0
 /// <summary> Constructor.</summary>
 ///
 /// <param name="name">        The name.</param>
 /// <param name="renderer">    The renderer.</param>
 /// <param name="turnManager"> Manager for turn.</param>
 public MainGameHUD(string name, IUIRenderer renderer, TurnManager turnManager)
     : base(name, renderer)
 {
     TurnManagerObject = turnManager;
 }