Exemplo n.º 1
0
        public void SelectButton(BluButton button)
        {
            if (Deselectable && button == SelectedButton)
            {
                foreach (BluButton b in Buttons)
                    b.Opacity = 1;

                SelectedButton = null;
                SelectedValue = null;

                return;
            }

            foreach (BluButton b in Buttons)
            {
                if (b == button || button == SelectedButton)
                {
                    b.Opacity = 1;

                    if (!Deselectable)
                        b.IsEnabled = false;

                    continue;
                }

                b.Opacity = 0.5;
                b.IsEnabled = true;
            }

            SelectedButton = button;
            SelectedValue = button.Content.ToString();
        }
Exemplo n.º 2
0
        // helper methods for adding buttons to stackpanels
        public static List<BluButton> MakeButtons(string[] content, StackPanel stackPanel, int width = 60, int height = 30)
        {
            List<BluButton> buttons = new List<BluButton>();

            foreach (string _c in content)
            {
                string c = _c;
                BluButton b = new BluButton(c, width, height);
                stackPanel.Children.Add(b);
                buttons.Add(b);
            }

            return buttons;
        }
Exemplo n.º 3
0
        public static List<BluButton> MakeButtons(string[] content, StackPanel[] stackPanels, int width = 60, int height = 30)
        {
            List<BluButton> buttons = new List<BluButton>();

            int i = 0;

            foreach (string _c in content)
            {
                string c = _c;
                BluButton b = new BluButton(c, width, height);
                stackPanels[i].Children.Add(b);
                buttons.Add(b);

                // todo: this is mildy old-school, make less so
                i += 1;
                if (i == stackPanels.Length)
                    i = 0;
            }

            return buttons;
        }