Beispiel #1
0
        public static Image GetNamedImageControl(string name)
        {
            Image i = new Image();

            i.Source = StringImageSmallIconConverter.FromName(name);
            i.Width  = 16;
            i.Height = 16;

            return(i);
        }
        private void UpdateConditionSubtype(ComboBox subtypeCombo, CombatHotKey hk)
        {
            subtypeCombo.IsEnabled = true;

            String hkcond = hk.Subtype;
            bool   found  = false;

            foreach (Condition c in from x in Condition.Conditions where x.Spell == null select x)
            {
                StackPanel panel = new StackPanel();
                panel.Orientation = Orientation.Horizontal;


                Image       i  = new Image();
                BitmapImage bi = StringImageSmallIconConverter.FromName(c.Image);
                i.Source = bi;
                i.Width  = 16;
                i.Height = 16;

                panel.Children.Add(i);
                panel.Children.Add(new TextBlock()
                {
                    Text = c.Name
                });
                ComboBoxItem cbi = new ComboBoxItem()
                {
                    Content = panel, Tag = c
                };

                subtypeCombo.Items.Add(cbi);

                if (c.Name == hkcond)
                {
                    subtypeCombo.SelectedItem = cbi;
                    found = true;
                }
            }
            if (!found)
            {
                subtypeCombo.SelectedIndex = 0;
            }
        }