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)
{
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.
//------------------------------------------------------------------------------
// 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
- TextEffectCollection.cs
- WebEventCodes.cs
- GlyphShapingProperties.cs
- CultureInfoConverter.cs
- Ops.cs
- EventItfInfo.cs
- DocumentProperties.cs
- RSAOAEPKeyExchangeDeformatter.cs
- RequestContext.cs
- LassoSelectionBehavior.cs
- VScrollProperties.cs
- RecommendedAsConfigurableAttribute.cs
- MutableAssemblyCacheEntry.cs
- AnimationTimeline.cs
- ParameterCollection.cs
- TableHeaderCell.cs
- WebServiceTypeData.cs
- SqlResolver.cs
- XmlCharType.cs
- DynamicILGenerator.cs
- ButtonBaseAdapter.cs
- RewritingSimplifier.cs
- _ContextAwareResult.cs
- elementinformation.cs
- NativeMethods.cs
- WpfWebRequestHelper.cs
- DataGridViewAutoSizeModeEventArgs.cs
- Cloud.cs
- _NegotiateClient.cs
- SqlBuffer.cs
- ToolStripGripRenderEventArgs.cs
- HttpPostProtocolImporter.cs
- MouseEvent.cs
- RoamingStoreFile.cs
- AdPostCacheSubstitution.cs
- ParameterToken.cs
- InputLanguage.cs
- HotSpotCollection.cs
- AppDomainAttributes.cs
- ToolStripItemTextRenderEventArgs.cs
- CodeSubDirectoriesCollection.cs
- ObjectViewListener.cs
- DecimalAnimationBase.cs
- EntityDataSourceUtil.cs
- ToggleButton.cs
- SingleObjectCollection.cs
- ArraySubsetEnumerator.cs
- DataGridViewSelectedCellCollection.cs
- DeflateEmulationStream.cs
- ThreadInterruptedException.cs
- FixedTextContainer.cs
- AssemblyAttributesGoHere.cs
- FormViewInsertedEventArgs.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- RepeaterItem.cs
- DesignerAutoFormatCollection.cs
- MediaSystem.cs
- SerializerWriterEventHandlers.cs
- MessagePropertyVariants.cs
- TextPattern.cs
- FieldMetadata.cs
- WinEventWrap.cs
- DataServicePagingProviderWrapper.cs
- OleStrCAMarshaler.cs
- MultiTrigger.cs
- NameSpaceEvent.cs
- dataSvcMapFileLoader.cs
- XmlDataDocument.cs
- _ScatterGatherBuffers.cs
- RuntimeEnvironment.cs
- precedingquery.cs
- ContentWrapperAttribute.cs
- DataTableReader.cs
- UnsafeNativeMethods.cs
- AudioException.cs
- WebRequest.cs
- HuffModule.cs
- ConfigurationStrings.cs
- SqlServer2KCompatibilityCheck.cs
- XmlToDatasetMap.cs
- SystemEvents.cs
- DrawTreeNodeEventArgs.cs
- TdsEnums.cs
- GetResponse.cs
- AttachedPropertiesService.cs
- OleDbDataAdapter.cs
- CustomAttribute.cs
- TabPage.cs
- IsolatedStoragePermission.cs
- ping.cs
- WeakReferenceKey.cs
- LoaderAllocator.cs
- CustomAssemblyResolver.cs
- DataGridState.cs
- Normalizer.cs
- AxisAngleRotation3D.cs
- ShaderEffect.cs
- RTTypeWrapper.cs
- CodeIdentifier.cs
- DebugController.cs