Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / ModelUtilities.cs / 1305376 / ModelUtilities.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Presentation.Model { using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Markup; // This class provides useful shared utility functions that are // needed by our ModelItemImpl class implementations. internal static class ModelUtilities { // Returns a wrapped type converter for the given item. internal static TypeConverter GetConverter(IModelTreeItem item) { return GetConverter(item.ModelTreeManager, item.ModelItem); } // Returns a wrapped converter for the given item. internal static TypeConverter GetConverter(ModelTreeManager modelTreeManager, ModelItem item) { return new ModelTypeConverter(modelTreeManager, XamlUtilities.GetConverter(item.ItemType)); } // Returns the default property on the item, or null if the item has internal static PropertyDescriptor GetDefaultProperty(ModelItem item) { DefaultPropertyAttribute propAttr = TypeDescriptor.GetAttributes(item.ItemType)[typeof(DefaultPropertyAttribute)] as DefaultPropertyAttribute; if (propAttr != null && !string.IsNullOrEmpty(propAttr.Name)) { ModelProperty prop = item.Properties.Find(propAttr.Name); if (prop != null) { return new ModelPropertyDescriptor(prop); } } return null; } // Wraps an item's properties in PropertyDescriptors and returns a // collection of them. internal static PropertyDescriptorCollection WrapProperties(ModelItem item) { Listdescriptors = new List (); foreach (ModelProperty prop in item.Properties) { descriptors.Add(new ModelPropertyDescriptor(prop)); } return new PropertyDescriptorCollection(descriptors.ToArray(), true); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Presentation.Model { using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Markup; // This class provides useful shared utility functions that are // needed by our ModelItemImpl class implementations. internal static class ModelUtilities { // Returns a wrapped type converter for the given item. internal static TypeConverter GetConverter(IModelTreeItem item) { return GetConverter(item.ModelTreeManager, item.ModelItem); } // Returns a wrapped converter for the given item. internal static TypeConverter GetConverter(ModelTreeManager modelTreeManager, ModelItem item) { return new ModelTypeConverter(modelTreeManager, XamlUtilities.GetConverter(item.ItemType)); } // Returns the default property on the item, or null if the item has internal static PropertyDescriptor GetDefaultProperty(ModelItem item) { DefaultPropertyAttribute propAttr = TypeDescriptor.GetAttributes(item.ItemType)[typeof(DefaultPropertyAttribute)] as DefaultPropertyAttribute; if (propAttr != null && !string.IsNullOrEmpty(propAttr.Name)) { ModelProperty prop = item.Properties.Find(propAttr.Name); if (prop != null) { return new ModelPropertyDescriptor(prop); } } return null; } // Wraps an item's properties in PropertyDescriptors and returns a // collection of them. internal static PropertyDescriptorCollection WrapProperties(ModelItem item) { List descriptors = new List (); foreach (ModelProperty prop in item.Properties) { descriptors.Add(new ModelPropertyDescriptor(prop)); } return new PropertyDescriptorCollection(descriptors.ToArray(), true); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Accessors.cs
- EFColumnProvider.cs
- EnumerableValidator.cs
- StructuralObject.cs
- KeyFrames.cs
- ExportOptions.cs
- BypassElementCollection.cs
- AttachedPropertyInfo.cs
- SQLInt64.cs
- ColorConvertedBitmap.cs
- ProxyFragment.cs
- DirectoryGroupQuery.cs
- WebReferencesBuildProvider.cs
- NetworkInformationPermission.cs
- WorkBatch.cs
- Trigger.cs
- RowsCopiedEventArgs.cs
- Asn1IntegerConverter.cs
- RewritingPass.cs
- GeneralTransformCollection.cs
- TreeSet.cs
- JulianCalendar.cs
- ListSourceHelper.cs
- WindowsToolbarItemAsMenuItem.cs
- IPEndPointCollection.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- CompositionAdorner.cs
- Helpers.cs
- SynchronizedCollection.cs
- AccessViolationException.cs
- DataGridViewSelectedColumnCollection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- ElapsedEventArgs.cs
- TableColumn.cs
- CacheForPrimitiveTypes.cs
- DescriptionCreator.cs
- PostBackTrigger.cs
- ConnectionManagementElement.cs
- ButtonChrome.cs
- ExpandedProjectionNode.cs
- SynchronizationLockException.cs
- WebPartDescriptionCollection.cs
- BeginCreateSecurityTokenRequest.cs
- ConsoleCancelEventArgs.cs
- SchemaInfo.cs
- LowerCaseStringConverter.cs
- SimpleFieldTemplateFactory.cs
- sqlmetadatafactory.cs
- TableStyle.cs
- InvokePattern.cs
- PeerApplicationLaunchInfo.cs
- AdPostCacheSubstitution.cs
- RequiredAttributeAttribute.cs
- BuildProvider.cs
- FormViewUpdatedEventArgs.cs
- CodeEventReferenceExpression.cs
- XmlComment.cs
- ChangeDirector.cs
- NameValueConfigurationElement.cs
- DataGridViewControlCollection.cs
- StaticExtension.cs
- AssemblyHelper.cs
- GetUserPreferenceRequest.cs
- RefreshPropertiesAttribute.cs
- MessageAction.cs
- ProcessInputEventArgs.cs
- AutomationTextAttribute.cs
- ManualResetEventSlim.cs
- XmlSchemaParticle.cs
- Privilege.cs
- SoapCodeExporter.cs
- TextEndOfParagraph.cs
- PathFigureCollection.cs
- BoundPropertyEntry.cs
- CodeCastExpression.cs
- Span.cs
- GeneratedContractType.cs
- IssuanceLicense.cs
- SystemBrushes.cs
- KeyTime.cs
- PopupEventArgs.cs
- _NegoStream.cs
- TargetPerspective.cs
- WebBrowserPermission.cs
- SchemaMerger.cs
- _NTAuthentication.cs
- XPathAxisIterator.cs
- CalendarDay.cs
- SiteMapPath.cs
- UInt64Converter.cs
- UnitySerializationHolder.cs
- SamlDoNotCacheCondition.cs
- UnlockInstanceAsyncResult.cs
- CodeAssignStatement.cs
- DeviceContext2.cs
- SchemaObjectWriter.cs
- TraceContextRecord.cs
- XPathNodeHelper.cs
- MultilineStringConverter.cs
- NameService.cs