Пример #1
0
        private void InitializeComponent()
        {
            panel1 = new Panel()
            {
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };
            stackPanel1 = new StackPanel(Orientation.Vertical)
            {
                Parent = panel1,
                Width  = 60,
            };
            var gb = new GroupBox()
            {
                BorderThickness = new Thickness(1),
                BorderColor     = Color.Cyan,
                Margin          = new Thickness(0, 0, 0, 1),
            };

            gb.AddContent(new Label("Welcome to command-line interface forms!!!")
            {
                Foreground    = Color.Cyan,
                TextAlignment = TextAlignment.Center,
            });
            stackPanel1.AddContent(gb);
            stackPanel1.AddContent(new Label("This App show you how to use properties and events of components in the list below:")
            {
                TextAlignment = TextAlignment.Center,
                WordWrap      = true,
            });
            stackPanel1.AddContent(new Label("Panel")
            {
                TextAlignment = TextAlignment.Center,
                Foreground    = Color.Green,
            });
            stackPanel1.AddContent(new Label("GroupBox")
            {
                TextAlignment = TextAlignment.Center,
                Foreground    = Color.Green,
            });
            stackPanel1.AddContent(new Label("StackPanel")
            {
                TextAlignment = TextAlignment.Center,
                Foreground    = Color.Green,
            });
            stackPanel1.AddContent(new Label("DockPanel")
            {
                TextAlignment = TextAlignment.Center,
                Foreground    = Color.Green,
            });
            stackPanel1.AddContent(new Label("If you want to continue press [space bar]. For close this window and exit from app press [Ctrl+F4]")
            {
                TextAlignment = TextAlignment.Center,
                WordWrap      = true,
            });
        }
Пример #2
0
        private void InitializeComponent()
        {
            panel1 = new Panel
            {
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };

            var grid = new Grid
            {
                Parent = panel1,
                Width  = 70,
                Margin = new Thickness(0, 1),
            };

            grid.RowDefinitions.Add(new RowDefinition(SizeType.Absolute, 3));
            grid.RowDefinitions.Add(new RowDefinition(SizeType.AutoSize));

            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 60));
            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 40));

            var lb1 = new Label
            {
                WordWrap = true,
                Text     = "GroupBox is a control that displays a frame around a control with an optional caption. It has only one child, but you can used any components for macking rich user interfaces",
            };

            grid.AddContent(lb1, 0, 0, 2);

            targetPanel = new GroupBox()
            {
                Background = Color.DarkMagenta,
                Text       = "Header",
            };

            var contentPanel = new Panel
            {
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };

            contentPanel.AddContent(new Label("Content")
            {
                Background = Color.Magenta,
                Foreground = Color.White,
            });
            targetPanel.AddContent(contentPanel);
            grid.AddContent(targetPanel, 0, 1);

            descriptionLabel = new Label("Let's check how to work TextAlignment, BorderThickness, BorderColor and BorderChars properties")
            {
                Margin   = new Thickness(1, 0, 0, 0),
                WordWrap = true,
            };
            grid.AddContent(descriptionLabel, 1, 1);
        }
Пример #3
0
        private void InitializeComponent()
        {
            panel1 = new Panel()
            {
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                AutoSize = false,
            };

            stackPanel1 = new StackPanel(Orientation.Vertical)
            {
                Width = 40,
            };
            groupBox1 = new GroupBox()
            {
                Background  = Color.Green,
                BorderColor = Color.DarkGreen,
            };
            stackPanel2 = new StackPanel(Orientation.Vertical)
            {
                Margin = new Thickness(5, 0),
            };

            label1 = new Label("Congratulations!!!")
            {
                Foreground    = Color.DarkGreen,
                TextAlignment = TextAlignment.Center,
            };
            stackPanel2.AddContent(label1);
            labelMapName = new Label()
            {
                Foreground    = Color.DarkGreen,
                TextAlignment = TextAlignment.Center,
                WordWrap      = true,
            };
            stackPanel2.AddContent(labelMapName);
            groupBox1.AddContent(stackPanel2);

            groupBox2 = new GroupBox()
            {
                Background  = Color.Gray,
                BorderColor = Color.DarkGray,
                Margin      = new Thickness(0, 1, 0, 0),
            };
            stackPanel3 = new StackPanel(Orientation.Vertical);
            stackPanel3.AddContent(new Label("Your achievements:")
            {
                TextAlignment = TextAlignment.Center,
                Margin        = new Thickness(0, 0, 0, 1),
            });
            grid1 = new Grid();
            grid1.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Absolute, 20));
            grid1.ColumnDefinitions.Add(new ColumnDefinition());

            grid1.RowDefinitions.Add(new RowDefinition(SizeType.Absolute, 1));
            grid1.AddContent(new Label("Steps taken"), 0, 0);
            labelSteps = new Label();
            grid1.AddContent(labelSteps, 1, 0);

            grid1.RowDefinitions.Add(new RowDefinition(SizeType.Absolute, 1));
            grid1.AddContent(new Label("Coins collected"), 0, 1);
            labelCoins = new Label();
            grid1.AddContent(labelCoins, 1, 1);

            stackPanel3.AddContent(grid1);

            groupBox2.AddContent(stackPanel3);

            stackPanel1.AddContent(groupBox1);
            stackPanel1.AddContent(groupBox2);
            panel1.AddContent(stackPanel1);
            AddContent(panel1);
        }
Пример #4
0
        private void InitializeComponent()
        {
            panel1 = new Panel
            {
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };

            var grid = new Grid
            {
                Parent = panel1,
                Width  = 70,
                Margin = new Thickness(0, 1),
            };

            grid.RowDefinitions.Add(new RowDefinition(SizeType.Absolute, 2));
            grid.RowDefinitions.Add(new RowDefinition(SizeType.AutoSize));

            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 40));
            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 60));

            var lb1 = new Label
            {
                WordWrap = true,
                Text     = "RadioButton enables the user to select a single option from a group of choices when paired with other RadioButton controls",
            };

            grid.AddContent(lb1, 0, 0, 2);


            var stackPanel = new StackPanel(Orientation.Vertical)
            {
                AutoSize = true,
                Padding  = new Thickness(1),
            };
            var grBox1 = new GroupBox()
            {
                Text    = "Group1",
                Margin  = new Thickness(0, 0, 0, 1),
                Padding = new Thickness(2, 0),
            };
            var grStackPanel1 = new StackPanel(Orientation.Vertical);

            for (int i = 1; i <= 3; i++)
            {
                var rButton = new RadioButton($"RadioButton{i}");
                rButton.OnCheckedChanged += CheckedChanged;
                grStackPanel1.AddContent(rButton);
            }
            grBox1.AddContent(grStackPanel1);
            stackPanel.AddContent(grBox1);

            var grBox2 = new GroupBox()
            {
                Text    = "Group2",
                Padding = new Thickness(2, 0),
            };
            var grStackPanel2 = new StackPanel(Orientation.Vertical);

            for (int i = 1; i <= 3; i++)
            {
                var rButton = new RadioButton($"RadioButton{i}");
                rButton.OnCheckedChanged += CheckedChanged;
                grStackPanel2.AddContent(rButton);
            }
            grBox2.AddContent(grStackPanel2);
            stackPanel.AddContent(grBox2);

            grid.AddContent(stackPanel, 0, 1);

            var propertyPanel = new StackPanel(Orientation.Vertical);

            propertyPanel.AddContent(
                new Label(
                    "Use [Tab]\\[Shift+Tab] for change focused radiobutton. [Space] or [Enter] to clik. When the user selects one option button (also known as a radio button) within a group, the others clear automatically. All RadioButton controls in a given container, such as a Window, constitute a group")
            {
                Margin   = new Thickness(1, 1, 0, 0),
                WordWrap = true,
            });
            propertyChangedLabel = new Label("Click on any radiobutton…")
            {
                Margin   = new Thickness(1, 1, 0, 0),
                WordWrap = true,
            };
            propertyPanel.AddContent(propertyChangedLabel);
            grid.AddContent(propertyPanel, 1, 1);
        }