WaveEngine.Components.UI.StackPanel.Add C# (CSharp) Method

Add() public method

Adds the specified UI.
UI component is null.
public Add ( UIBase ui ) : void
ui UIBase The UI.
return void
        public void Add(UIBase ui)
        {
            if (ui == null)
            {
                throw new ArgumentNullException("UI component is null.");
            }

            this.entity.AddChild(ui.Entity);
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Creates a new BestScore panel.
        /// </summary>
        /// <param name="y">The y of the new element.</param>
        /// <param name="score">The score of the new element.</param>
        /// <returns></returns>
        public static StackPanel CreateBestScore(int y, int score)
        {
            var stackPanelScore = new StackPanel()
            {
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                Orientation = WaveEngine.Components.UI.Orientation.Horizontal,
                Margin = new Thickness(
                            0,
                            y,
                            0,
                            0)
            };

            var bestScoreText = new Image(WaveContent.Assets.Menus.best_score_png);

            var bestScoreNumber = new TextBlock()
            {
                FontPath =  WaveContent.Assets.Fonts.BadaBoom_BB_wpk,
                Text = score.ToString(),
                TextAlignment = WaveEngine.Components.UI.TextAlignment.Right,
                Width = 50,
            };

            stackPanelScore.Add(bestScoreText);
            stackPanelScore.Add(bestScoreNumber);

            return stackPanelScore;
        }
All Usage Examples Of WaveEngine.Components.UI.StackPanel::Add