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
- EditBehavior.cs
- GridViewSortEventArgs.cs
- ToolStripLocationCancelEventArgs.cs
- _DisconnectOverlappedAsyncResult.cs
- GridItemPattern.cs
- DesignerActionPropertyItem.cs
- ObjectReaderCompiler.cs
- ClassValidator.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- SplineKeyFrames.cs
- MenuScrollingVisibilityConverter.cs
- TransportDefaults.cs
- Compiler.cs
- LinqDataSourceContextData.cs
- HitTestParameters.cs
- EventRoute.cs
- JsonReader.cs
- ResourceKey.cs
- MemoryPressure.cs
- QilPatternFactory.cs
- NameValuePermission.cs
- ExpandedWrapper.cs
- FieldBuilder.cs
- TreeNode.cs
- PersonalizationState.cs
- ImageSource.cs
- TextServicesDisplayAttribute.cs
- EventListener.cs
- CodeDomDesignerLoader.cs
- XmlSchemaExporter.cs
- CompositeFontParser.cs
- System.Data.OracleClient_BID.cs
- UpDownEvent.cs
- Visual.cs
- DataListItemEventArgs.cs
- DatePickerDateValidationErrorEventArgs.cs
- MissingMemberException.cs
- ComAdminWrapper.cs
- CheckBox.cs
- Bold.cs
- HashStream.cs
- BidOverLoads.cs
- CSharpCodeProvider.cs
- Animatable.cs
- App.cs
- CompositeClientFormatter.cs
- Constants.cs
- tooltip.cs
- InfoCardTrace.cs
- WebPartTransformerAttribute.cs
- NetWebProxyFinder.cs
- Graphics.cs
- EntityDataSourceUtil.cs
- XmlDigitalSignatureProcessor.cs
- ColumnReorderedEventArgs.cs
- JapaneseCalendar.cs
- ZoneIdentityPermission.cs
- HtmlInputControl.cs
- EventSourceCreationData.cs
- XPathParser.cs
- HtmlFormAdapter.cs
- OneOfScalarConst.cs
- ConfigXmlAttribute.cs
- StringBlob.cs
- RemoteCryptoTokenProvider.cs
- DataTableClearEvent.cs
- EntityDataSourceWrapperCollection.cs
- ConsoleTraceListener.cs
- BasePattern.cs
- TrustLevelCollection.cs
- CodeDomSerializationProvider.cs
- CodeTypeParameter.cs
- Vector3D.cs
- ToolStripLocationCancelEventArgs.cs
- XmlArrayItemAttribute.cs
- ZipQueryOperator.cs
- TreeNodeEventArgs.cs
- clipboard.cs
- MaskedTextBox.cs
- CounterSampleCalculator.cs
- PointConverter.cs
- SecurityResources.cs
- WebDisplayNameAttribute.cs
- Literal.cs
- SqlAliasesReferenced.cs
- ZipIOBlockManager.cs
- ManagedCodeMarkers.cs
- CheckBoxStandardAdapter.cs
- SecurityElement.cs
- MasterPage.cs
- WebRequest.cs
- TypeBuilderInstantiation.cs
- ThreadStaticAttribute.cs
- CodeDirectoryCompiler.cs
- HandoffBehavior.cs
- TemplateKey.cs
- HtmlInputButton.cs
- JavaScriptObjectDeserializer.cs
- DispatcherHookEventArgs.cs
- UInt32Converter.cs