FlatRedBall.Arrow.Gui.TextInputWindow.AddTreeView C# (CSharp) Method

AddTreeView() public method

public AddTreeView ( IEnumerable listOfItems ) : System.Windows.Controls.TreeView
listOfItems IEnumerable
return System.Windows.Controls.TreeView
        public TreeView AddTreeView(IEnumerable<object> listOfItems)
        {
            TreeView treeView = new TreeView();
            treeView.HorizontalAlignment = HorizontalAlignment.Stretch;
            treeView.VerticalAlignment = VerticalAlignment.Top;
            treeView.Height = 80;
            treeView.Margin = new Thickness(3);

            List<object> itemsSource = new List<object>();
            itemsSource.AddRange(listOfItems);
            treeView.ItemsSource = itemsSource;

            AddControl(treeView);

            return treeView;
        }

Usage Example

Exemplo n.º 1
0
        public ArrowElementSave Element()
        {
            TextInputWindow tiw = new TextInputWindow();

            tiw.Text = "Enter new element name:";

            List<string> intentNames = new List<string>();

            const string noIntent = "<NO INTENT>";

            intentNames.Add(noIntent);
            foreach (var item in ArrowState.Self.CurrentArrowProject.Intents)
            {
                intentNames.Add(item.Name);
            }



            var treeView = tiw.AddTreeView(intentNames);


            var result = tiw.ShowDialog();

            if (result.HasValue && result.Value)
            {

                ArrowElementSave toReturn = new ArrowElementSave();
                toReturn.Name = tiw.Result;
                ArrowProjectSave projectToAddTo = ArrowState.Self.CurrentArrowProject;

                if (treeView.SelectedItem as string != noIntent)
                {
                    toReturn.Intent = treeView.SelectedItem as string;

                    ArrowIntentSave intent = new ArrowIntentSave();
                    IntentManager.Self.AddRequirementsForIntent(toReturn, intent);
                }

                projectToAddTo.Elements.Add(toReturn);

                ArrowCommands.Self.File.SaveProject();
                ArrowCommands.Self.File.GenerateGlux();
                ArrowState.Self.CurrentArrowProjectVm.Refresh();

                return toReturn;
            }
            else
            {
                return null;
            }
        }
All Usage Examples Of FlatRedBall.Arrow.Gui.TextInputWindow::AddTreeView