protected void LoadRows() { // Clear current Grid Selection this.Grid.SelectedRows.Clear(); if (this.Binding != null) { this.SetColumnEditing(); Model.Item item = (Model.Item) this.Binding; List <Model.Item> currentitems = item.Relationships(this.RelationshipType).CurrentItems(); // Set Number of Rows in Grid this.Grid.NoRows = currentitems.Count(); // Load Current Items into Grid for (int i = 0; i < this.Grid.NoRows; i++) { Model.Relationship relationship = (Model.Relationship)currentitems[i]; int j = 0; foreach (Model.PropertyType proptype in this.PropertyTypes) { Model.Property property = null; if (relationship.ItemType.Equals(proptype.Type)) { property = relationship.Property(proptype); } else { if (relationship.Related != null) { property = relationship.Related.Property(proptype); } } if (property != null) { this.Grid.Rows[i].Cells[j].Binding = property; } else { this.Grid.Rows[i].Cells[j].SetValue(null); } j++; } } } else { // Clear all Rows this.Grid.NoRows = 0; } this.UpdateCommandsCanExecute(); }