Example #1
0
        public static void add(this TextBox textbox, string placeholder)
        {
            //base styles
            textbox.Text       = placeholder;
            textbox.Foreground = SpecialColor.placeholder();

            //effect on focus (toggle placeholder)
            textbox.GotFocus += (s, e) => {
                if (textbox.Text == placeholder)
                {
                    placeholderChanger(textbox, SpecialColor.black(), "");
                }
            };
            textbox.LostFocus += (s, e) => {
                if (textbox.Text == "")
                {
                    placeholderChanger(textbox, SpecialColor.placeholder(), placeholder);
                }
            };
        }
        /// <summary>
        /// Создает уведомление, которое принимет текст, который будет содержать уведомление, и формат уведомления
        /// типы форматов:
        /// classic - классический серый фон и классивеский синий шрифт(при неправильном параметре, будет установлен по умолчанию);
        /// red     - красный фон и белый шрифт;
        /// green   - зеленый фон и белый шрифт;
        /// orange  - оранженый фон и белый шрифт
        /// </summary>
        /// <param name="text">Текст уведомления</param>
        /// <param name="format">Формат уведомления</param>
        public void AnswerTip(string text, string format)
        {
            Label label = new Label();

            label.Content = text;
            if (format == "red")
            {
                label.Foreground = SpecialColor.white();
                label.Background = SpecialColor.red();
            }
            else if (format == "green")
            {
                label.Foreground = SpecialColor.white();
                label.Background = SpecialColor.green();
            }
            else if (format == "orange")
            {
                label.Foreground = SpecialColor.white();
                label.Background = SpecialColor.orange();
            }
            this.tPage.answerTips.Children.Add(label);
        }