示例#1
0
 public DataRow(DataTable owner)
 {
     this._owner = owner;
 }
        /// <summary>
        /// The create member table columns.
        /// </summary>
        private void CreateMemberTableColumns()
        {
            if (MembersTable == null)
            {
                _membersTable = new DataTable(Guid.NewGuid().ToString());
                _membersTable.TBaseClass = TBaseClass;
            }
            else
            {
                // Remove all data of  Grid, we did not use MembersTable.Rows.Clear() because sometimes data of Grid change but design of grid not change.
                int rowCount = MembersTable.Rows.Count;
                int index = 0;
                while (index <= rowCount - 1)
                {
                    MembersTable.Rows.RemoveAt(0);
                    index++;
                }

            }
            _membersTable.Columns.Clear();

            foreach (var systemColum in GridColumns)
            {
                DataColumn column = new DataColumn
                {
                    ColumnName = systemColum.ColumnName,
                    Header = systemColum.Header,
                    DataType = typeof(int),
                };
                column.IsReadOnly = true;
                _membersTable.Columns.Add(column);
            }

            MembersTable = _membersTable;
            Columns = GeneratedColumnsForGrid();

            foreach (var column in Columns)
            {
                var txt = new TextBlock();
                txt.Text = column.Header.ToString();
                txt.TextAlignment = column.HeaderTextAlignment;
                txt.TextWrapping = TextWrapping.Wrap;
                txt.FontSize = 11;
                column.Header = txt;
            }
        }
        private void CreateMemberTableColumns()
        {

            if (MembersTable == null)
            {
                _membersTable = new DataTable(Guid.NewGuid().ToString());
                _membersTable.TBaseClass = TBaseClass;
            }
            _membersTable.Columns.Clear();

            foreach (var systemColum in GridColumns)
            {
                DataColumn column = new DataColumn
                {
                    ColumnName = systemColum.ColumnName,
                    Header = systemColum.Header,
                    DataType = typeof(string)
                };
                column.IsReadOnly = true;
                _membersTable.Columns.Add(column);
            }

            MembersTable = _membersTable;
            Columns = GeneratedColumnsForGrid();

            foreach (var column in Columns)
            {
                var txt = new TextBlock();
                txt.Text = column.Header.ToString();
                txt.TextWrapping = TextWrapping.Wrap;

                column.Header = txt;
            }
        }