AddControl() public method

public AddControl ( Control control ) : void
control System.Windows.Controls.Control
return void
Ejemplo n.º 1
0
        internal void ElementInstance()
        {
            if (ArrowState.Self.CurrentArrowElementSave != null)
            {
                //Show a text input window for the name, but add a combo box so the user can select the type
                TextInputWindow tiw = new TextInputWindow();

                TreeView treeView = new TreeView();
                treeView.HorizontalAlignment = HorizontalAlignment.Stretch;
                treeView.VerticalAlignment = VerticalAlignment.Top;
                treeView.Height = 80;
                treeView.Margin = new Thickness(3);

                List<ArrowElementSave> toAddToTreeView = new List<ArrowElementSave>();

                foreach (var elementSave in ArrowState.Self.CurrentArrowProject.Elements)
                {
                    if (elementSave != null && elementSave != ArrowState.Self.CurrentArrowElementSave)
                    {
                        toAddToTreeView.Add(elementSave);
                    }
                }

                treeView.ItemsSource = toAddToTreeView;

                tiw.AddControl(treeView);



                bool? result = tiw.ShowDialog();

                if (result.HasValue && result.Value)
                {
                    ArrowElementSave typeToAdd = treeView.SelectedItem as ArrowElementSave;

                    string name = tiw.Result;

                    ElementInstance(name, typeToAdd);
                }
                //tiw.AddControl
            }
        }