当前位置: 首页>>代码示例>>C#>>正文


C# Grid.SetRowColumn方法代码示例

本文整理汇总了C#中System.Windows.Controls.Grid.SetRowColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.SetRowColumn方法的具体用法?C# Grid.SetRowColumn怎么用?C# Grid.SetRowColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Grid的用法示例。


在下文中一共展示了Grid.SetRowColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EncapsulateControls

        private void EncapsulateControls()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            Grid grid_buttons = new Grid();
            grid_buttons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50.0, GridUnitType.Star) });
            grid_buttons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50.0, GridUnitType.Star) });
            grid_main.SetRowColumn(grid_buttons, 1, 0);

            Button button_accept = new Button() { Content = "Accept" };
            button_accept.Click += (sender, args) => { Accepted = true; Close(); };
            grid_buttons.SetRowColumn(button_accept, 0, 0);

            Button button_cancel = new Button() { Content = "Cancel" };
            button_cancel.Click += (sender, args) => { Close(); };
            grid_buttons.SetRowColumn(button_cancel, 0, 1);

            UIElement thatContent = Content as UIElement;
            Content = null;
            if (thatContent != null)
                grid_main.SetRowColumn(thatContent, 0, 0);
            Content = grid_main;
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:25,代码来源:Window_AcceptCancel.cs

示例2: CreateContent

        public UIElement CreateContent(string fileName, IEnumerable<Filter> filters)
        {
            Grid grid_main = new Grid();
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });

            m_textBox_fileName = new TextBox();
            m_textBox_fileName.TextChanged += (sender, args) => { FileName = m_textBox_fileName.Text; };
            m_textBox_fileName.Text = fileName;
            grid_main.SetRowColumn(m_textBox_fileName, 0, 0);

            Button button_openFile = new Button() { Content = "Open file ..." };
            button_openFile.Click += (x, y) =>
            {
                System.Windows.Forms.OpenFileDialog openFileDialog =
                    new System.Windows.Forms.OpenFileDialog()
                    {
                        Filter = (filters != null) ? filters.Select(f => f.ToString()).Aggregate((a,b) => string.Format("{0}|{1}", a, b)) : string.Empty,
                        CheckFileExists = true,
                        CheckPathExists = true
                    };
                if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    m_textBox_fileName.Text = openFileDialog.FileName;
            };
            grid_main.SetRowColumn(button_openFile, 0, 1);

            return grid_main;
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:28,代码来源:Window_OpenFile.cs

示例3: CreateControls

        private void CreateControls()
        {
            m_grid_main = new Grid();
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) });

            ////////
            // ComboBox
            m_comboBox_physicsInstanceDefinitions = new UserControl_NewAndSelect<PhysicsInstanceDefinition>(DataManager.PhysicsInstanceDefinitions, New, Select);
            m_grid_main.SetRowColumn(m_comboBox_physicsInstanceDefinitions, 0, 0);

            ////////
            // Fin
            Content = m_grid_main;
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:15,代码来源:TabItem_PhysicsInstanceDefinition.cs

示例4: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
                validator_name
            }};
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:35,代码来源:UserControl_AudioType.cs

示例5: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            Grid grid_sub = new Grid();
            grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_main.SetRowColumn(grid_sub, 3, 0);

            Grid grid_left = new Grid();
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_left.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_sub.SetRowColumn(grid_left, 0, 0);

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // Texture
            Button button_texture = new Button() { Content = " ... " };
            button_texture.Click += (x, y) => { SelectTextureFile(); };
            m_textBox_texture = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_texture = new ValidatorPanel(m_textBox_texture, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_texture = new Label() { Content = "Texture File: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_texture = new Grid();
            grid_texture.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_texture.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_texture.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_texture.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_texture.SetRowColumn(button_texture, 1, 1);
            grid_texture.SetRowColumn(validator_texture, 1, 0);
            Grid.SetColumnSpan(label_texture, 2);
            grid_texture.SetRowColumn(label_texture, 0, 0);
            grid_main.SetRowColumn(grid_texture, 2, 0);

            ////////
            // Duration
            m_doubleUpDown_duration = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            Label label_duration = new Label() { Content = "Duration: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_duration = new Grid();
            grid_duration.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_duration.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_duration.SetRowColumn(m_doubleUpDown_duration, 1, 0);
            grid_duration.SetRowColumn(label_duration, 0, 0);
            grid_left.SetRowColumn(grid_duration, 0, 0);

            ////////
            // Width
            m_doubleUpDown_width = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_width = new ValidatorPanel(m_doubleUpDown_width, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_width = new Label() { Content = "Width: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_width = new Grid();
            grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_width.SetRowColumn(validator_width, 1, 0);
            grid_width.SetRowColumn(label_width, 0, 0);
            grid_left.SetRowColumn(grid_width, 1, 0);

            ////////
            // Height
            m_doubleUpDown_height = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_height = new ValidatorPanel(m_doubleUpDown_height, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_height = new Label() { Content = "Height: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_height = new Grid();
            grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_height.SetRowColumn(validator_height, 1, 0);
            grid_height.SetRowColumn(label_height, 0, 0);
            grid_left.SetRowColumn(grid_height, 2, 0);

//.........这里部分代码省略.........
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:101,代码来源:UserControl_AnimationFrameDefinition.cs

示例6: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // Order
            m_integerUpDown_order = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            Label label_order = new Label() { Content = "Order: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_order = new Grid();
            grid_order.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_order.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_order.SetRowColumn(m_integerUpDown_order, 1, 0);
            grid_order.SetRowColumn(label_order, 0, 0);
            grid_main.SetRowColumn(grid_order, 2, 0);

            ////////
            // Width
            m_doubleUpDown_width = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_width = new ValidatorPanel(m_doubleUpDown_width, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_width = new Label() { Content = "Width: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_width = new Grid();
            grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_width.SetRowColumn(validator_width, 1, 0);
            grid_width.SetRowColumn(label_width, 0, 0);
            grid_main.SetRowColumn(grid_width, 3, 0);

            ////////
            // Height
            m_doubleUpDown_height = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_height = new ValidatorPanel(m_doubleUpDown_height, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_height = new Label() { Content = "Height: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_height = new Grid();
            grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_height.SetRowColumn(validator_height, 1, 0);
            grid_height.SetRowColumn(label_height, 0, 0);
            grid_main.SetRowColumn(grid_height, 4, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
                validator_name,
                validator_width,
                validator_height
            }};
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:75,代码来源:UserControl_Level.cs

示例7: CreateControls

            private void CreateControls()
            {
                Grid grid_main = new Grid();
                grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(33.3, GridUnitType.Star) });
                grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });

                TextBox textBox_dataName = new TextBox();
                Binding binding_textBox_dataName =
                    new Binding("DataName")
                    {
                        Source = this,
                        Mode = BindingMode.TwoWay,
                        UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                    };
                textBox_dataName.SetBinding(TextBox.TextProperty, binding_textBox_dataName);

                grid_main.SetRowColumn(textBox_dataName, 0, 0);

                Content = grid_main;
            }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:20,代码来源:UserControl_LevelLayoutDataEditor.cs

示例8: AddLevelLayoutDataControlGrid

 private void AddLevelLayoutDataControlGrid(UserControl_LevelLayoutData userControl_levelLayoutData)
 {
     Grid grid = new Grid();
     grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
     grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
     Button button_remove = new Button() { Content = "-" };
     button_remove.Click += (x, y) =>
     {
         var uc = userControl_levelLayoutData;
         var button = x as Button;
         if (x != null && x == button_remove)
         {
             m_grid_data.Children.Remove(grid);
             m_userControls_levelLayoutData.Remove(uc);
         }
     };
     grid.SetRowColumn(userControl_levelLayoutData, 0, 0);
     grid.SetRowColumn(button_remove, 0, 1);
     m_grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
     m_grid_data.SetRowColumn(grid, m_grid_data.RowDefinitions.Count - 1, 0);
     m_userControls_levelLayoutData.Add(userControl_levelLayoutData);
 }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:22,代码来源:UserControl_LevelLayoutDataEditor.cs

示例9: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            /*m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);*/

            ////////
            // Priority
            m_integerUpDown_priority = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_priority = new ValidatorPanel(m_integerUpDown_priority, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_priority = new Label() { Content = "Priority: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_priority = new Grid();
            grid_priority.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_priority.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_priority.SetRowColumn(validator_priority, 1, 0);
            grid_priority.SetRowColumn(label_priority, 0, 0);
            grid_main.SetRowColumn(grid_priority, 2, 0);

            ////////
            // X
            /*m_doubleUpDown_x = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_x = new ValidatorPanel(m_doubleUpDown_x, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_x = new Label() { Content = "X: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_x = new Grid();
            grid_x.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_x.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_x.SetRowColumn(validator_x, 1, 0);
            grid_x.SetRowColumn(label_x, 0, 0);
            grid_main.SetRowColumn(grid_x, 3, 0);*/

            ////////
            // Y
            /*m_doubleUpDown_y = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_y = new ValidatorPanel(m_doubleUpDown_y, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_y = new Label() { Content = "Y: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_y = new Grid();
            grid_y.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_y.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_y.SetRowColumn(validator_y, 1, 0);
            grid_y.SetRowColumn(label_y, 0, 0);
            grid_main.SetRowColumn(grid_y, 4, 0);*/

            ////////
            // Data
            m_grid_data = new Grid();
            m_grid_data.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            Grid grid_newData = new Grid();
            Label label_data = new Label() { Content = "Data: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            var enumNames = Enum.GetNames(typeof(UserControl_LevelLayoutData.DataType));
            var enumValues = Enum.GetValues(typeof(UserControl_LevelLayoutData.DataType)).OfType<UserControl_LevelLayoutData.DataType>().ToArray();
            for(int i = 0, j = enumNames.Length, percent = 100 / j; i < j; ++i)
            {
                var enumName = enumNames[i];
                var enumValue = enumValues[i];

                grid_newData.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(percent, GridUnitType.Star) });
                Button button_addNewData = new Button() { Content = "+ " + enumName };
                button_addNewData.Click += (x,y) =>
                    {
                        var ev = enumValue;
                        AddLevelLayoutDataControl(ev);
                    };
                grid_newData.SetRowColumn(button_addNewData, 0, i);
            }
            Grid grid_data = new Grid();
            grid_data.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_data.SetRowColumn(m_grid_data, 2, 0);
            grid_data.SetRowColumn(grid_newData, 1, 0);
            grid_data.SetRowColumn(label_data, 0, 0);
//.........这里部分代码省略.........
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:101,代码来源:UserControl_LevelLayoutDataEditor.cs

示例10: CreateControls

        private UIElement CreateControls()
        {
            m_menu_main = new Menu();

            ////////
            // File
            m_menuItem_loadReaderWriter = new MenuItem() { Header = "Load ReaderWriter DLL" };
            m_menuItem_loadReaderWriter.Click += MenuItem_LoadReaderWriter_Click;

            m_menuItem_file = new MenuItem() { Header = "File" };
            m_menuItem_file.Items.Add(m_menuItem_loadReaderWriter);

            m_menu_main.Items.Add(m_menuItem_file);

            ////////
            // Toolbar
            DockPanel dockPanel_main = new DockPanel();
            dockPanel_main.Children.Add(m_menu_main);
            DockPanel.SetDock(m_menu_main, Dock.Top);

            ////////
            // grid
            m_grid_main = new Grid();
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) });
            m_grid_main.SetRowColumn(dockPanel_main, 0, 0);

            return m_grid_main;
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:29,代码来源:MainWindow.xaml.cs

示例11: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // EntityInstanceDefinition
            CollectionViewSource collectionViewSource_entityInstanceDefinition =
                new CollectionViewSource()
                {
                    Source = DataManager.EntityInstanceDefinitions
                };
            m_comboBox_entityInstanceDefinition =
                new ComboBox()
                {
                    DisplayMemberPath = "Name",
                    IsTextSearchEnabled = true
                };
            m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition });
            ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull());

            Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_entityInstanceDefinition = new Grid();
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0);
            grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0);
            grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0);

            ////////
            // ZOrder
            m_integerUpDown_zOrder = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_zOrder = new ValidatorPanel(m_integerUpDown_zOrder, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_zOrder = new Label() { Content = "Z-Order: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_zOrder = new Grid();
            grid_zOrder.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_zOrder.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_zOrder.SetRowColumn(validator_zOrder, 1, 0);
            grid_zOrder.SetRowColumn(label_zOrder, 0, 0);
            grid_main.SetRowColumn(grid_zOrder, 3, 0);

            ////////
            // RenderPass
            m_integerUpDown_renderPass = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_renderPass = new ValidatorPanel(m_integerUpDown_renderPass, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_renderPass = new Label() { Content = "Render Pass: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_renderPass = new Grid();
            grid_renderPass.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_renderPass.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_renderPass.SetRowColumn(validator_renderPass, 1, 0);
            grid_renderPass.SetRowColumn(label_renderPass, 0, 0);
            grid_main.SetRowColumn(grid_renderPass, 4, 0);

            ////////
            // GroupBox and RadioButtons
            m_radioButton_animation = new RadioButton() { HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center };
            m_radioButton_font = new RadioButton() { HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center };
            Label label_radioButton_animation = new Label() { Content = "Animation", HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center };
            Label label_radioButton_font = new Label() { Content = "Font", HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center };

            Grid grid_radioButtons = new Grid();
            grid_radioButtons.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_radioButtons.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_radioButtons.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_radioButtons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_radioButtons.SetRowColumn(m_radioButton_animation, 0, 0);
            grid_radioButtons.SetRowColumn(label_radioButton_animation, 0, 1);
            grid_radioButtons.SetRowColumn(m_radioButton_font, 1, 0);
            grid_radioButtons.SetRowColumn(label_radioButton_font, 1, 1);
            MultiValidatorPanel validator_radioButtons = new MultiValidatorPanel(grid_radioButtons, new[] {
                    m_radioButton_animation,
                    m_radioButton_font
//.........这里部分代码省略.........
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:101,代码来源:UserControl_GraphicsInstanceDefinition.cs

示例12: SetThisContent

        protected override void SetThisContent()
        {
            m_grid_main = new Grid();
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) });
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // ComboBox (Entity Instance Definition)
            var collectionViewSource_EntityInstanceDefintion = new CollectionViewSource() { Source = DataManager.EntityInstanceDefinitions };
            m_comboBox_EntityInstanceDefinitions =
                new ComboBox()
                {
                    DisplayMemberPath = "Name",
                    IsTextSearchEnabled = true
                };
            m_comboBox_EntityInstanceDefinitions.SetBinding(ItemsControl.ItemsSourceProperty, new Binding { Source = collectionViewSource_EntityInstanceDefintion });
            Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance Definition: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            m_button_entityInstanceDefinition = new Button() { Content = "Add" };
            m_button_entityInstanceDefinition.Click += Button_EntityInstanceDefinition_Click;
            Grid grid_entityInstanceDefinition = new Grid();
            grid_entityInstanceDefinition.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_entityInstanceDefinition.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_entityInstanceDefinition.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_entityInstanceDefinition.SetRowColumn(m_button_entityInstanceDefinition, 0, 2);
            grid_entityInstanceDefinition.SetRowColumn(m_comboBox_EntityInstanceDefinitions, 0, 1);
            grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0);
            m_grid_main.SetRowColumn(grid_entityInstanceDefinition, 0, 0);

            ////////
            // Canvas
            m_canvas = new UserControl_CanvasWithMovableElements();
            m_canvas.ElementSelected += Canvas_ElementSelected;
            m_viewer =
                new ScrollViewer()
                {
                    VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Visible,
                    Content = m_canvas
                };
            m_grid_main.SetRowColumn(m_viewer, 1, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = m_grid_main, FirstFocus = m_comboBox_EntityInstanceDefinitions };
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:46,代码来源:UserControl_LevelEditor.cs

示例13: CreateControls

        private void CreateControls(string title, bool enabled)
        {
            m_grid_main = new Grid() { Background = Brushes.Transparent };
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100.0, GridUnitType.Star) });
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            m_grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            m_groupBox =
                new GroupBox()
                {
                    Header = title,
                    Content = m_grid_main,
                    IsEnabled = enabled,
                };
            Content = m_groupBox;

            m_grid_main.SetRowColumn(new Separator() { Margin = new Thickness(0.0, 10.0, 0.0, 5.0) } , 1, 0);

            Grid grid_buttons = new Grid();
            grid_buttons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50.0, GridUnitType.Star) });
            grid_buttons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50.0, GridUnitType.Star) });
            m_grid_main.SetRowColumn(grid_buttons, 2, 0);

            m_button_accept = new Button() { Content = "Accept" };
            m_button_accept.Click += (sender, args) =>
            {
                RaiseChangesAccepted(); Disable();
            };
            grid_buttons.SetRowColumn(m_button_accept, 0, 0);

            Button button_cancel = new Button() { Content = "Cancel" };
            button_cancel.Click += (sender, args) => { RaiseChangesCancelled(); Disable(); };
            grid_buttons.SetRowColumn(button_cancel, 0, 1);
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:34,代码来源:UserControl_ActivateAcceptCancel.cs

示例14: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, Text = (m_behaviorInstanceDefinition != null) ? m_behaviorInstanceDefinition.Id.ToString() : "N/A" };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // EntityInstanceDefinition
            CollectionViewSource collectionViewSource_entityInstanceDefinition =
                new CollectionViewSource()
                {
                    Source = DataManager.EntityInstanceDefinitions
                };
            m_comboBox_entityInstanceDefinition =
                new ComboBox()
                {
                    DisplayMemberPath = "Name",
                    IsTextSearchEnabled = true
                };
            m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition });
            ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull());

            Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_entityInstanceDefinition = new Grid();
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0);
            grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0);
            grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0);

            ////////
            // Behavior File
            Button button_behaviorFile = new Button() { Content = " ... " };
            button_behaviorFile.Click += (x, y) => { SelectBehaviorFile(); };
            m_textBox_behaviorFile = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_behaviorFile = new ValidatorPanel(m_textBox_behaviorFile, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_behaviorFile = new Label() { Content = "Behavior File: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_behaviorFile = new Grid();
            grid_behaviorFile.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_behaviorFile.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_behaviorFile.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_behaviorFile.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_behaviorFile.SetRowColumn(button_behaviorFile, 1, 1);
            grid_behaviorFile.SetRowColumn(validator_behaviorFile, 1, 0);
            Grid.SetColumnSpan(label_behaviorFile, 2);
            grid_behaviorFile.SetRowColumn(label_behaviorFile, 0, 0);
            grid_main.SetRowColumn(grid_behaviorFile, 3, 0);

            ////////
            // Behavior Constructor
            m_textBlock_behaviorConstructor = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_behaviorConstructor = new Label() { Content = "Behavior Constructor: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_behaviorConstructor = new ValidatorPanel(m_textBlock_behaviorConstructor, TextBlock.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Grid grid_behaviorConstructor = new Grid();
            grid_behaviorConstructor.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_behaviorConstructor.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_behaviorConstructor.SetRowColumn(validator_behaviorConstructor, 1, 0);
            grid_behaviorConstructor.SetRowColumn(label_behaviorConstructor, 0, 0);
            grid_main.SetRowColumn(grid_behaviorConstructor, 4, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
                validator_name,
                validator_entityInstanceDefinition,
                validator_behaviorFile,
                validator_behaviorConstructor
            }};
        }
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:95,代码来源:UserControl_BehaviorInstanceDefinition.cs

示例15: SetThisContent

        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // BoundingData
            Grid grid_sub = new Grid();
            grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(30.0, GridUnitType.Star) });
            grid_sub.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(70.0, GridUnitType.Star) });
            grid_main.SetRowColumn(grid_sub, 5, 0);

            m_grid_subSub = new Grid();
            grid_sub.SetRowColumn(m_grid_subSub, 0, 0);

            m_image = new Image() { Stretch = System.Windows.Media.Stretch.None };
            m_canvasWithRectangle = new UserControl_CanvasWithRectangle(new[] { m_image }) { Width = 500, Height = 500 };
            grid_sub.SetRowColumn(m_canvasWithRectangle, 0, 1);

            m_canvasWithRectangle.SizableRectangle.Width =
                m_canvasWithRectangle.SizableRectangle.Height =
                    c_defaultWidthHeight;

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // EntityInstanceDefinition
            CollectionViewSource collectionViewSource_entityInstanceDefinition =
                new CollectionViewSource()
                {
                    Source = DataManager.EntityInstanceDefinitions
                };
            m_comboBox_entityInstanceDefinition =
                new ComboBox()
                {
                    DisplayMemberPath = "Name",
                    IsTextSearchEnabled = true
                };
            m_comboBox_entityInstanceDefinition.SelectionChanged += ComboBox_EntityInstanceDefinition_SelectionChanged;
            m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition });
            ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull());

            Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_entityInstanceDefinition = new Grid();
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0);
            grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0);
            grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0);

            ////////
            // CollisionType
            CollectionViewSource collectionViewSource_collisionType =
                new CollectionViewSource()
                {
                    Source = DataManager.CollisionTypes
                };
            m_comboBox_collisionType =
                new ComboBox()
                {
                    DisplayMemberPath = "Name",
                    IsTextSearchEnabled = true
                };
            m_comboBox_collisionType.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_collisionType });
            ValidatorPanel validator_collisionType = new ValidatorPanel(m_comboBox_collisionType, ComboBox.SelectedItemProperty, new Validate_NotNull());

            Label label_collisionType = new Label() { Content = "Collision Type: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_collisionType = new Grid();
            grid_collisionType.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_collisionType.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_collisionType.SetRowColumn(validator_collisionType, 1, 0);
            grid_collisionType.SetRowColumn(label_collisionType, 0, 0);
            grid_main.SetRowColumn(grid_collisionType, 3, 0);

//.........这里部分代码省略.........
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:101,代码来源:UserControl_PhysicsInstanceDefinition.cs


注:本文中的System.Windows.Controls.Grid.SetRowColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。