示例#1
0
        //自定义属性
        private void getProperty()
        {
            CustomPropertyCollection collection = new CustomPropertyCollection();
            Type type = mCurrentSelectObject.GetType();

            collection.Add(new CustomProperty("字体", "Font", "外观", "字体。", mCurrentSelectObject));

            switch (type.Name)
            {
            case "Label":
            case "TextBox":
            case "Panel":
                collection.Add(new CustomProperty("文本对齐", "TextAlign", "内容", "文本对齐方式。", mCurrentSelectObject));
                collection.Add(new CustomProperty("边框", "BorderStyle", "外观", "边框。", mCurrentSelectObject));
                collection.Add(new CustomProperty("背景色", "BackColor", "外观", "背景色。", mCurrentSelectObject));
                collection.Add(new CustomProperty("字体颜色", "ForeColor", "外观", "前景色。", mCurrentSelectObject));
                collection.Add(new CustomProperty("文本内容", "Text", "内容", "显示的文本内容。", mCurrentSelectObject, typeof(System.ComponentModel.Design.MultilineStringEditor)));
                break;
            }

            collection.Add(new CustomProperty("宽度", "Width", "大小", "大小。", mCurrentSelectObject));
            collection.Add(new CustomProperty("高度", "Height", "大小", "大小。", mCurrentSelectObject));

            collection.Add(new CustomProperty("Left", "Left", "位置", "左。", mCurrentSelectObject));
            collection.Add(new CustomProperty("Top", "Top", "位置", "右。", mCurrentSelectObject));

            propertyGrid1.SelectedObject = collection;
        }
示例#2
0
        public virtual CustomPropertyCollection GetProperties(IContent product, VariantPublishedContent variant = null)
        {
            CustomPropertyCollection properties = new CustomPropertyCollection();

            foreach (string productPropertyAlias in StoreService.Get(GetStoreId(product)).ProductSettings.ProductPropertyAliases)
            {
                properties.Add(new CustomProperty(productPropertyAlias, GetPropertyValue <string>(product, productPropertyAlias, variant))
                {
                    IsReadOnly = true
                });
            }

            return(properties);
        }
        public virtual CustomPropertyCollection GetProperties(XPathNavigator model, bool useCachedInformation = true)
        {
            CustomPropertyCollection properties = new CustomPropertyCollection();

            foreach (string productPropertyAlias in StoreService.Get(GetStoreId(model, useCachedInformation)).ProductSettings.ProductPropertyAliases)
            {
                properties.Add(new CustomProperty(productPropertyAlias, GetPropertyValue(model, productPropertyAlias, useCachedInformation: useCachedInformation))
                {
                    IsReadOnly = true
                });
            }

            return(properties);
        }
        public virtual CustomPropertyCollection GetProperties( XPathNavigator model, bool useCachedInformation = true )
        {
            CustomPropertyCollection properties = new CustomPropertyCollection();

              foreach ( string productPropertyAlias in StoreService.Get( GetStoreId( model, useCachedInformation ) ).ProductSettings.ProductPropertyAliases ) {
            properties.Add( new CustomProperty( productPropertyAlias, GetPropertyValue( model, productPropertyAlias, useCachedInformation: useCachedInformation ) ) { IsReadOnly = true } );
              }

              return properties;
        }