當前位置: 首頁>>代碼示例>>C#>>正文


C# PropertyDescriptorCollection.Remove方法代碼示例

本文整理匯總了C#中System.ComponentModel.PropertyDescriptorCollection.Remove方法的典型用法代碼示例。如果您正苦於以下問題:C# PropertyDescriptorCollection.Remove方法的具體用法?C# PropertyDescriptorCollection.Remove怎麽用?C# PropertyDescriptorCollection.Remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.ComponentModel.PropertyDescriptorCollection的用法示例。


在下文中一共展示了PropertyDescriptorCollection.Remove方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetProperties

 public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
    PropertyDescriptor pd;
    var pdc = new PropertyDescriptorCollection(base.GetProperties(attributes).Cast<PropertyDescriptor>().ToArray());
    if ((pd = pdc.Find("Source", false)) != null)
    {
       pdc.Add(TypeDescriptor.CreateProperty(typeof(Binding), pd, new Attribute[] { new DefaultValueAttribute("null") }));
       pdc.Remove(pd);
    }
    return pdc;
 }
開發者ID:c0ns0le,項目名稱:WindowsPowerShell-1,代碼行數:11,代碼來源:OutXaml.cs

示例2: ReplaceTrackingPropertyDescriptors

        /// <summary>
        /// Replaces the property descriptors for the tracking property.
        /// </summary>
        /// <remarks>
        /// Returned descriptors allow the properties to be reset with tracked value and resume tracking once modified.
        /// </remarks>
        internal PropertyDescriptorCollection ReplaceTrackingPropertyDescriptors(PropertyDescriptorCollection properties)
        {
            // Replace the existing descriptor for the DisplayName property
            DomainPropertyInfo displayNameProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.DisplayNameDomainPropertyId);
            DomainPropertyInfo displayNameTrackingProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.IsDisplayNameTrackingDomainPropertyId);
            var displayNameDescriptor = properties[Reflector<NamedElementSchema>.GetProperty(e => e.DisplayName).Name];
            if (displayNameDescriptor != null)
            {
                properties.Remove(displayNameDescriptor);
                properties.Add(new TrackingPropertyDescriptor(this, displayNameProperty, displayNameTrackingProperty, 
                    displayNameDescriptor.Attributes.Cast<Attribute>().ToArray<Attribute>()));
            }

            // Replace the existing descriptor for the Description property
            DomainPropertyInfo descriptionProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.DescriptionDomainPropertyId);
            DomainPropertyInfo descriptionTrackingProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.IsDescriptionTrackingDomainPropertyId);
            var descriptionDescriptor = properties[Reflector<NamedElementSchema>.GetProperty(e => e.Description).Name];
            if (descriptionDescriptor != null)
            {
                properties.Remove(descriptionDescriptor);
                properties.Add(new TrackingPropertyDescriptor(this, descriptionProperty, descriptionTrackingProperty, 
                    descriptionDescriptor.Attributes.Cast<Attribute>().ToArray<Attribute>()));
            }

            // Replace the existing descriptor for the CodeIdentifier property
            DomainPropertyInfo codeIdentifierProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.CodeIdentifierDomainPropertyId);
            DomainPropertyInfo codeIdentifierTrackingProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.IsCodeIdentifierTrackingDomainPropertyId);
            var codeIdentifierDescriptor = properties[Reflector<NamedElementSchema>.GetProperty(e => e.CodeIdentifier).Name];
            if (codeIdentifierDescriptor != null)
            {
                properties.Remove(codeIdentifierDescriptor);
                properties.Add(new TrackingPropertyDescriptor(this, codeIdentifierProperty, codeIdentifierTrackingProperty, 
                    codeIdentifierDescriptor.Attributes.Cast<Attribute>().ToArray<Attribute>()));
            }

            return properties;
        }
開發者ID:StevenVanDijk,項目名稱:NuPattern,代碼行數:43,代碼來源:PropertyTracking.gen.cs

示例3: ConvertPropertys

 private PropertyDescriptorCollection ConvertPropertys(PropertyDescriptorCollection pdc)
 {
     PropertyDescriptor pd = pdc.Find("ItemsSource", false);
     if (pd != null)
     {
         PropertyDescriptor pdNew = TypeDescriptor.CreateProperty(typeof(ItemsControl), pd, new Attribute[]
                                                                                                {
                                                                                                    new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible),
                                                                                                    new DefaultValueAttribute("")
                                                                                                });
         pdc.Add(pdNew);
         pdc.Remove(pd);
     }
     return pdc;
 }
開發者ID:Jedzia,項目名稱:BackBock,代碼行數:15,代碼來源:ItemsControlCustomTypeDescriptor.cs

示例4: PropertyDescriptorCollection

        PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(new PropertyDescriptor[0]);
            foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(this))
            {
                pdc.Add(pd);
            }

            //put Position property on top
            PropertyDescriptor posd = pdc["pPosition"];
            pdc.Remove(posd);
            pdc.Insert(0, posd);

            foreach (String key in CustomProperties.Keys)
            {
                pdc.Add(new DictionaryPropertyDescriptor(CustomProperties, key, attributes));
            }
            return pdc;
        }
開發者ID:bradens,項目名稱:OldGameTools,代碼行數:19,代碼來源:Item.ICustomTypeDescriptor.cs

示例5: FilterProperties

		protected override void FilterProperties(PropertyDescriptorCollection globalizedProps)
		{
			base.FilterProperties(globalizedProps);
			PropertyDescriptor copyLocalPD = globalizedProps["CopyLocal"];
			globalizedProps.Remove(copyLocalPD);
			if (defaultCopyLocalValue != null) {
				globalizedProps.Add(new ReplaceDefaultValueDescriptor(copyLocalPD, defaultCopyLocalValue.Value));
			} else {
				globalizedProps.Add(new DummyValueDescriptor(copyLocalPD));
			}
			
			if (string.IsNullOrEmpty(HintPath))
				globalizedProps.Remove(globalizedProps["HintPath"]);
		}
開發者ID:hpsa,項目名稱:SharpDevelop,代碼行數:14,代碼來源:ReferenceProjectItem.cs

示例6: ModifyDynamicProperties

        /// <summary>
        /// This is a callback function for DynamicTypeDescriptionProvider.
        /// You can modify the collection in this method.
        /// Things you can do in this method:
        ///   Hide a property
        ///   Show a property
        ///   Add/Remove attributes of a property
        ///   Create a new property on the fly
        ///   
        /// More info: http://www.codeproject.com/KB/grid/PropertyGridDynamicProp.aspx 
        /// </summary>
        /// <param name="pdc"></param>
        public void ModifyDynamicProperties(PropertyDescriptorCollection pdc)
        {
            PropertyDescriptor pd = pdc.Find("SourcePath", false);
            pdc.Remove(pd);

            switch (DecodingMode)
            {
                case JobDecodingMode.SingleDecoding:
                    pdc.Add(TypeDescriptor.CreateProperty(
                        this.GetType(),
                        pd,
                        new EditorAttribute(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(UITypeEditor))
                        ));
                    break;
                case JobDecodingMode.BatchDecoding:
                    pdc.Add(TypeDescriptor.CreateProperty(
                        this.GetType(),
                        pd,
                        new EditorAttribute(typeof(FolderEditor), typeof(UITypeEditor))
                        ));
                    break;
            }

            pd = pdc.Find("FilterText", false);
            pdc.Remove(pd);
            pdc.Add(TypeDescriptor.CreateProperty(this.GetType(), pd, new ReadOnlyAttribute(!IsFilterActive)));

            pd = pdc.Find("FormatterSettings", false);
            pdc.Remove(pd);
            pdc.Add(TypeDescriptor.CreateProperty(this.GetType(), pd, new ReadOnlyAttribute(!IsFormatterActive)));
        }
開發者ID:Killersssurprise,項目名稱:cdr-decoder,代碼行數:43,代碼來源:DecoderJob.cs

示例7: AssertReadOnly

		private void AssertReadOnly (PropertyDescriptorCollection descriptors, string testCase)
		{
			MockPropertyDescriptor mockPropertyDescr = new MockPropertyDescriptor (
				"Date", DateTime.Now);

			try {
				descriptors.Add (mockPropertyDescr);
				Assert.Fail (testCase + "#1");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			// ensure read-only check if performed before value is checked
			try {
				descriptors.Add (null);
				Assert.Fail (testCase + "#2");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			try {
				descriptors.Clear ();
				Assert.Fail (testCase + "#3");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			try {
				descriptors.Insert (0, mockPropertyDescr);
				Assert.Fail (testCase + "#4");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			// ensure read-only check if performed before value is checked
			try {
				descriptors.Insert (0, null);
				Assert.Fail (testCase + "#5");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			try {
				descriptors.Remove (mockPropertyDescr);
				Assert.Fail (testCase + "#6");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			// ensure read-only check if performed before value is checked
			try {
				descriptors.Remove (null);
				Assert.Fail (testCase + "#7");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			try {
				descriptors.RemoveAt (0);
				Assert.Fail (testCase + "#8");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			IList list = (IList) descriptors;
			Assert.IsTrue (((IList) descriptors).IsReadOnly, testCase + "#9");
			Assert.IsTrue (((IList) descriptors).IsFixedSize, testCase + "#10");

			try {
				list.Add (mockPropertyDescr);
				Assert.Fail (testCase + "#11");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			// ensure read-only check if performed before value is checked
			try {
				list.Add (null);
				Assert.Fail (testCase + "#12");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			try {
				list.Clear ();
				Assert.Fail (testCase + "#13");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			try {
				list.Insert (0, mockPropertyDescr);
				Assert.Fail (testCase + "#14");
			} catch (NotSupportedException) {
				// read-only collection cannot be modified
			}

			// ensure read-only check if performed before value is checked
			try {
				list.Insert (0, null);
//.........這裏部分代碼省略.........
開發者ID:Profit0004,項目名稱:mono,代碼行數:101,代碼來源:PropertyDescriptorCollectionTests.cs

示例8: ModifyProperties

 private void ModifyProperties(PropertyDescriptorCollection col)
 {
     if (!ShowB)
     {
         col.Remove(col.Find("InputB", true));
     }
     if (!ShowA)
     {
         col.Remove(col.Find("InputA", true));
     }
 }
開發者ID:redrhino,項目名稱:NinjaTrader.Base,代碼行數:11,代碼來源:TestProperties.cs

示例9: FilterProperties

		protected override void FilterProperties(PropertyDescriptorCollection col)
		{
			base.FilterProperties(col);
			PropertyDescriptor oldValue = col["Value"];
			col.Remove(oldValue);
			col.Add(new CustomValuePropertyDescriptor(oldValue, entry.Type ?? typeof(string)));
			PropertyDescriptor oldRoaming = col["Roaming"];
			col.Remove(oldRoaming);
			col.Add(new RoamingPropertyDescriptor(oldRoaming, entry));
		}
開發者ID:2594636985,項目名稱:SharpDevelop,代碼行數:10,代碼來源:SettingsEntryPropertyGridWrapper.cs


注:本文中的System.ComponentModel.PropertyDescriptorCollection.Remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。