示例#1
0
        private void TextBlock_category_AppearanceAccToContent(object sender)
        {
            TextBlock tb = sender as TextBlock;

            if (tb == null)
            {
                return;
            }

            if (ComponentUtils.LOWER_CASE_SINGLE.IsMatch(tb.Text))
            {
                tb.ToolTip = "IST NICHT " + ComponentUtils.CategoryStringToDescription(tb.Text);
                tb.Effect  = null;
            }
            else if (ComponentUtils.UPPER_CASE_SINGLE.IsMatch(tb.Text))
            {
                tb.ToolTip = "IST " + ComponentUtils.CategoryStringToDescription(tb.Text);
                tb.Effect  = new DropShadowEffect()
                {
                    Color       = (Color)ColorConverter.ConvertFromString("#FF0000ff"),
                    Direction   = 315,
                    ShadowDepth = 2,
                    BlurRadius  = 1,
                    Opacity     = 1
                };
            }
        }
示例#2
0
        private void PopulteGrid()
        {
            StackPanel sp = new StackPanel();

            sp.Orientation = Orientation.Horizontal;
            sp.Effect      = new DropShadowEffect()
            {
                Color       = (Color)ColorConverter.ConvertFromString("#FF551700"),
                Direction   = 315,
                ShadowDepth = 3,
                BlurRadius  = 3,
                Opacity     = 0.5
            };

            string category_basic = ComponentUtils.CATEGORY_NONE_AS_STR;

            for (int i = 0; i < this.nr_columns; i++)
            {
                // category symbols
                TextBlockDoubleText tb = new TextBlockDoubleText();
                tb.Width      = 22;
                tb.Height     = 26;
                tb.TextCopy   = category_basic[i].ToString();
                tb.ToolTip    = "IST NICHT " + ComponentUtils.CategoryStringToDescription(tb.Text.ToUpper());
                tb.Padding    = new Thickness(2, 2, 1, 1);
                tb.FontSize   = 20;
                tb.FontFamily = new FontFamily(new Uri("pack://application:,,,/ComponentBuilder;component/Data/fonts/"), "./#categories");
                tb.Style      = (Style)tb.TryFindResource("CategoryLabel");
                tb.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF00044d"));
                tb.TextChangedEventHandler += TextBlock_category_AppearanceAccToContent;
                tb.Tag = i;

                sp.Children.Add(tb);
            }

            Grid.SetRow(sp, 0);
            Grid.SetColumn(sp, 0);
            this.sp_Symbols = sp;
            this.Children.Add(sp);
        }
        private void PopulateStackPanel_Categories()
        {
            // category toggles
            int nr_categories = Enum.GetNames(typeof(Category)).Count();

            for (int i = 0; i < nr_categories - 2; i++)
            {
                ToggleButton tbtn = new ToggleButton();
                tbtn.Style             = (Style)tbtn.TryFindResource("ToggleButtonBWRound");
                tbtn.Content           = ComponentUtils.CATEGORY_NONE_AS_STR[i].ToString().ToUpper();
                tbtn.FontFamily        = new FontFamily(new Uri("pack://application:,,,/ComponentBuilder;component/Data/fonts/"), "./#categories");
                tbtn.FontSize          = 18;
                tbtn.Margin            = new Thickness(0, 0, 2, 0);
                tbtn.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                tbtn.ToolTip           = ComponentUtils.CategoryStringToDescription(tbtn.Content.ToString());
                tbtn.Tag    = ComponentUtils.StringToCategory(tbtn.Content.ToString());
                tbtn.Cursor = Cursors.Hand;
                tbtn.Click += category_CLick;

                this.Children.Add(tbtn);
            }
        }