private void AddRow(PoEModData mod = null)
        {
            DockPanel p = new DockPanel()
            {
                Margin = new Thickness(5, 0, 5, 5), HorizontalAlignment = HorizontalAlignment.Stretch, Background = Brushes.AliceBlue
            };
            Button b = new Button()
            {
                Content = "X", Width = 20
            };

            b.Click += Remove_Click;
            DockPanel.SetDock(b, Dock.Left);
            p.Children.Add(b);
            SearchableComboBox c = new SearchableComboBox()
            {
                ItemsSource = new List <PoEModData>(BenchCrafts.Keys), HorizontalAlignment = HorizontalAlignment.Stretch, IsEditable = true, IsTextSearchEnabled = false
            };

            if (mod != null)
            {
                c.SelectedItem = mod;
            }
            p.Children.Add(c);
            ModList.Children.Add(p);
        }
Пример #2
0
        private void AddRow(string l, double?v1, double?v2)
        {
            int  fields = Type == GroupType.Weight ? 1 : 2;
            Grid g      = new Grid();

            g.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            g.ColumnDefinitions.Add(new ColumnDefinition());
            Button b = new Button()
            {
                Content = "X", Width = 20, Height = 20
            };

            b.Click += RemoveRow_Click;
            Grid.SetColumn(b, 0);
            g.Children.Add(b);
            SearchableComboBox label = new SearchableComboBox()
            {
                ItemsSource = new List <string>(Stats), IsEditable = true, IsTextSearchEnabled = false
            };

            if (Stats.Contains(l))
            {
                label.SelectedItem = l;
            }
            label.ItemsPanel = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(VirtualizingStackPanel)));
            Grid.SetColumn(label, 1);
            g.Children.Add(label);
            for (int i = 0; i < fields; i++)
            {
                g.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
                NumberBox n = new NumberBox()
                {
                    AllowDouble = true, Width = 60, TextAlignment = TextAlignment.Center
                };
                if (i == 0 && v1 != null)
                {
                    n.Text = v1.ToString();
                }
                if (i == 1 && v2 != null)
                {
                    n.Text = v2.ToString();
                }
                Grid.SetColumn(n, g.ColumnDefinitions.Count - 1);
                g.Children.Add(n);
            }
            ContentPanel.Children.Add(g);
        }