Ejemplo n.º 1
0
 public MyTagChips(Data.Tags tag)
 {
     this.PropertyChanged += MyTagChips_PropertyChanged;
     this.Height           = 24;
     this.MyTag            = tag;
     this.CreateComponents();
 }
Ejemplo n.º 2
0
        public void SetTags(Data.Tags Tag)
        {
            this.Icon = new MaterialDesignThemes.Wpf.PackIcon()
            {
                Kind = MaterialDesignThemes.Wpf.PackIconKind.Tag
            };

            var color = ColorFunctions.FromHexString(Tag.Color);

            if (color != null)
            {
                if (color.Value.R + color.Value.G + color.Value.B < 382)
                {
                    this.IconForeground = new SolidColorBrush(Colors.White);
                }
                else
                {
                    this.IconForeground = new SolidColorBrush(Colors.Black);
                }
                this.IconBackground = new SolidColorBrush(color.Value);
                this.BorderBrush    = this.IconBackground;
            }
            else
            {
                this.IconBackground = new SolidColorBrush(Colors.LightGray);
            }
            this.Content = Tag.TagName;
        }