Esempio n. 1
0
        private void CustomizeColumns(CollectionProperty collectionProperty)
        {
            PropertiesView.Columns.Clear();
            foreach (var property in collectionProperty.Properties)
            {
                var column = new GridColumn();
                column.FieldName = property.Key;
                var objectProperty = property.Value as ObjectProperty;
                if (objectProperty != null)
                {
                    column.ColumnEdit = DesignerExtensions.CreateRepositoryItem(repositoryItemButtonEdit_ButtonClick);
                }
                else
                {
                    var innerCollectionProperty = property.Value as CollectionProperty;
                    if (innerCollectionProperty != null)
                    {
                        column.ColumnEdit = DesignerExtensions.CreateRepositoryItem(repositoryItemButtonEdit_ButtonClick);
                    }
                    else
                    {
                        column.ColumnEdit = _repository.GetRepositoryItem(property.Key, property.Value) ??
                                            (!string.IsNullOrEmpty(PropertyName)
                                                ? _repository.GetRepositoryItem(PropertyName + "." + property.Key,
                                                                                property.Value)
                                                : null);
                    }
                }

                column.Visible = true;
                PropertiesView.Columns.Add(column);
            }
        }
Esempio n. 2
0
        public void SetSimpleProperties(Dictionary <string, IControlProperty> properties)
        {
            _simpleProperties = properties;
            _snapshotSimpleProperties.Clear();

            SimplePropertiesGrid.Rows.Clear();
            SimplePropertiesGrid.RowHeaderWidth = 300;
            SimplePropertiesGrid.RecordWidth    = 350;
            foreach (var property in properties)
            {
                var editorRow = new EditorRow();
                editorRow.Properties.Caption = property.Key;
                editorRow.Name = property.Key;
                var propertyObjectValue = property.Value as ObjectProperty;
                if (propertyObjectValue != null)
                {
                    editorRow.Properties.RowEdit =
                        DesignerExtensions.CreateRepositoryItem(repositoryItemButtonEdit_ButtonClick);
                    editorRow.Properties.RowEdit.Tag = propertyObjectValue;
                    editorRow.Properties.Value       = propertyObjectValue.Value;

                    _snapshotSimpleProperties.Add(property.Key, propertyObjectValue.Value);
                }
                else
                {
                    editorRow.Properties.RowEdit = _repository.GetRepositoryItem(property.Key, property.Value) ??
                                                   (!string.IsNullOrEmpty(ParentProperty)
                                                       ? _repository.GetRepositoryItem(
                                                        ParentProperty + "." + property.Key, property.Value)
                                                       : null);

                    editorRow.Properties.Value = property.Value.Value;
                    _snapshotSimpleProperties.Add(property.Key, property.Value.Value);
                }

                SimplePropertiesGrid.Rows.Add(editorRow);
            }
        }