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
- ManipulationDelta.cs
- InstancePersistenceException.cs
- Model3D.cs
- ButtonField.cs
- XmlSchemaGroupRef.cs
- HttpRequest.cs
- XmlAtomicValue.cs
- ConstraintManager.cs
- XmlParserContext.cs
- FontCollection.cs
- CacheDependency.cs
- ButtonFieldBase.cs
- Math.cs
- ProfilePropertyNameValidator.cs
- AppSettingsReader.cs
- RoutingExtensionElement.cs
- Vector3DKeyFrameCollection.cs
- ModelItemExtensions.cs
- BindingCompleteEventArgs.cs
- TypeUtil.cs
- Task.cs
- TextBoxBase.cs
- ArgumentsParser.cs
- ReferentialConstraint.cs
- PipeSecurity.cs
- XmlSchemas.cs
- XmlNamedNodeMap.cs
- InProcStateClientManager.cs
- DoubleIndependentAnimationStorage.cs
- PointConverter.cs
- Clock.cs
- Soap11ServerProtocol.cs
- FormattedTextSymbols.cs
- JpegBitmapEncoder.cs
- errorpatternmatcher.cs
- HGlobalSafeHandle.cs
- DoubleIndependentAnimationStorage.cs
- XmlTextAttribute.cs
- WrappedIUnknown.cs
- RelationshipNavigation.cs
- CapacityStreamGeometryContext.cs
- IsolatedStorageFile.cs
- SynchronizedDispatch.cs
- ToolStripLabel.cs
- BindingMemberInfo.cs
- CodeEntryPointMethod.cs
- DynamicMethod.cs
- WebBrowserEvent.cs
- XmlHierarchicalDataSourceView.cs
- KeyConverter.cs
- ValueConversionAttribute.cs
- ItemList.cs
- WindowsNonControl.cs
- NativeCompoundFileAPIs.cs
- XmlCustomFormatter.cs
- Line.cs
- OuterGlowBitmapEffect.cs
- ObjectItemAttributeAssemblyLoader.cs
- PointLight.cs
- IdnMapping.cs
- ForEachAction.cs
- WebUtility.cs
- SkinBuilder.cs
- ObjectQueryProvider.cs
- SafeCertificateContext.cs
- FormattedTextSymbols.cs
- FilteredDataSetHelper.cs
- UndoManager.cs
- SineEase.cs
- XmlSchemaSimpleContentRestriction.cs
- GenericParameterDataContract.cs
- ProcessModelInfo.cs
- cache.cs
- CallbackHandler.cs
- SingleKeyFrameCollection.cs
- Attributes.cs
- InvalidCastException.cs
- TextParaLineResult.cs
- VisualBasicDesignerHelper.cs
- FileDetails.cs
- HtmlInputControl.cs
- ObfuscationAttribute.cs
- RemotingSurrogateSelector.cs
- dataSvcMapFileLoader.cs
- RouteValueExpressionBuilder.cs
- ItemChangedEventArgs.cs
- BufferedWebEventProvider.cs
- LongValidator.cs
- SafeNativeMethodsCLR.cs
- Odbc32.cs
- ToolboxDataAttribute.cs
- RectValueSerializer.cs
- RtfNavigator.cs
- PageAsyncTask.cs
- PageMediaType.cs
- DelegatedStream.cs
- XLinq.cs
- BaseValidator.cs
- RawStylusSystemGestureInputReport.cs
- TextCompositionManager.cs