Esempio n. 1
0
        private void InitialiseDataGrid()
        {
            DataGridTableStyle tableStyle = new DataGridTableStyle();

            DataGridExpandableColumn nameColumn = new DataGridExpandableColumn();

            nameColumn.ReadOnly    = true;
            nameColumn.MappingName = m_nameColumnMappingName;
            nameColumn.HeaderText  = NameColumnHeaderText;
            nameColumn.Width       = 100;
            nameColumn.Expand     += new MemberWrapperEventHandler(nameColumn_Expand);
            nameColumn.Collapse   += new MemberWrapperEventHandler(nameColumn_Collapse);
            tableStyle.GridColumnStyles.Add(nameColumn);

            if (ShowMemberTypeColumn)
            {
                DataGridTextBoxColumn memberTypeColumn = new DataGridTextBoxColumn();
                memberTypeColumn.ReadOnly    = true;
                memberTypeColumn.MappingName = m_memberTypeColumnMappingName;
                memberTypeColumn.HeaderText  = "Member Type";
                memberTypeColumn.Width       = 150;
                tableStyle.GridColumnStyles.Add(memberTypeColumn);
            }

            DataGridTextBoxColumn valueTypeColumn = new DataGridTextBoxColumn();

            valueTypeColumn.ReadOnly    = true;
            valueTypeColumn.MappingName = m_valueTypeColumnMappingName;
            valueTypeColumn.HeaderText  = "Value Type";
            valueTypeColumn.Width       = 150;
            tableStyle.GridColumnStyles.Add(valueTypeColumn);

            DataGridEditorColumn editorColumn = new DataGridEditorColumn();

            editorColumn.MappingName = m_editorColumnMappingName;
            editorColumn.HeaderText  = "Value";
            editorColumn.NullText    = "<null>";
            tableStyle.GridColumnStyles.Add(editorColumn);

            tableStyle.HeaderForeColor   = SystemColors.ControlText;
            tableStyle.RowHeadersVisible = false;
            tableStyle.MappingName       = typeof(MemberWrappers).Name;
            tableStyle.DataGrid          = this.grid;
            grid.TableStyles.Add(tableStyle);

            nameColumn.Initialise();
            editorColumn.Initialise();
            editorColumn.EditorCommitted += new MemberWrapperEventHandler(editorColumn_EditorCommitted);

            m_initialised = true;
        }