Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Model / AttachedPropertiesService.cs / 1305376 / AttachedPropertiesService.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Presentation.Model
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime;
public class AttachedPropertiesService
{
List properties;
public AttachedPropertiesService()
{
this.properties = new List();
}
public void AddProperty(AttachedProperty property)
{
if (property == null)
{
throw FxTrace.Exception.AsError(new ArgumentNullException("property"));
}
if (string.IsNullOrEmpty(property.Name))
{
throw FxTrace.Exception.AsError(new ArgumentException(SR.AttachedPropertyNameShouldNotBeEmpty));
}
this.properties.Add(property);
}
internal IEnumerable GetAttachedProperties(Type modelItemType)
{
var properties = from property in this.properties
where property.OwnerType.IsAssignableFrom(modelItemType) select property;
if (modelItemType.IsGenericType)
{
var propertiesFromGenericRoot = from property in this.properties
where property.OwnerType.IsAssignableFrom(modelItemType.GetGenericTypeDefinition())
select property;
properties = properties.Concat(propertiesFromGenericRoot).Distinct();
}
return properties;
}
}
}
// 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.Linq;
using System.Text;
using System.Runtime;
public class AttachedPropertiesService
{
List properties;
public AttachedPropertiesService()
{
this.properties = new List();
}
public void AddProperty(AttachedProperty property)
{
if (property == null)
{
throw FxTrace.Exception.AsError(new ArgumentNullException("property"));
}
if (string.IsNullOrEmpty(property.Name))
{
throw FxTrace.Exception.AsError(new ArgumentException(SR.AttachedPropertyNameShouldNotBeEmpty));
}
this.properties.Add(property);
}
internal IEnumerable GetAttachedProperties(Type modelItemType)
{
var properties = from property in this.properties
where property.OwnerType.IsAssignableFrom(modelItemType) select property;
if (modelItemType.IsGenericType)
{
var propertiesFromGenericRoot = from property in this.properties
where property.OwnerType.IsAssignableFrom(modelItemType.GetGenericTypeDefinition())
select property;
properties = properties.Concat(propertiesFromGenericRoot).Distinct();
}
return properties;
}
}
}
// 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
- UriScheme.cs
- XmlSerializationGeneratedCode.cs
- InvalidCastException.cs
- XmlSchemaSimpleContentExtension.cs
- _NTAuthentication.cs
- XmlSchemaComplexContent.cs
- InvalidEnumArgumentException.cs
- MemberDomainMap.cs
- RootProfilePropertySettingsCollection.cs
- ObjectParameter.cs
- ADConnectionHelper.cs
- MatrixTransform.cs
- Application.cs
- FontWeightConverter.cs
- SafeUserTokenHandle.cs
- WebPartCatalogAddVerb.cs
- ContourSegment.cs
- MimeAnyImporter.cs
- DetailsViewPagerRow.cs
- PasswordPropertyTextAttribute.cs
- RouteItem.cs
- CommandCollectionEditor.cs
- UxThemeWrapper.cs
- PeerPresenceInfo.cs
- WorkflowNamespace.cs
- ProcessHostFactoryHelper.cs
- DetailsViewDeletedEventArgs.cs
- CookieHandler.cs
- EditorBrowsableAttribute.cs
- ResourceContainer.cs
- GeneralTransformGroup.cs
- GridLengthConverter.cs
- WebServicesDescriptionAttribute.cs
- DbConnectionHelper.cs
- ObjectTokenCategory.cs
- BrowserCapabilitiesCompiler.cs
- EmptyQuery.cs
- ToolStripManager.cs
- OracleCommand.cs
- XmlRootAttribute.cs
- PersonalizablePropertyEntry.cs
- ExpressionConverter.cs
- StylusPlugInCollection.cs
- DbParameterCollectionHelper.cs
- DataGridRow.cs
- SourceSwitch.cs
- DoubleIndependentAnimationStorage.cs
- SecurityUtils.cs
- SqlAliaser.cs
- Script.cs
- WebPartConnectionsConfigureVerb.cs
- EventTrigger.cs
- NetworkCredential.cs
- ConnectionStringsExpressionBuilder.cs
- SafeFileHandle.cs
- RtfToken.cs
- InternalDispatchObject.cs
- FormViewDeletedEventArgs.cs
- StorageComplexTypeMapping.cs
- ReadContentAsBinaryHelper.cs
- ReaderOutput.cs
- LineGeometry.cs
- CodeIndexerExpression.cs
- ThrowHelper.cs
- GuidTagList.cs
- WebRequest.cs
- DotExpr.cs
- SolidBrush.cs
- ArithmeticException.cs
- ActiveXContainer.cs
- DesignerTextViewAdapter.cs
- Cursor.cs
- XamlSerializerUtil.cs
- SoapCodeExporter.cs
- ColumnPropertiesGroup.cs
- RuntimeUtils.cs
- SoapServerMethod.cs
- FunctionDetailsReader.cs
- CultureInfo.cs
- SqlNotificationEventArgs.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- NavigationPropertyEmitter.cs
- BulletChrome.cs
- DesignBindingEditor.cs
- DoubleLinkListEnumerator.cs
- FileDialog.cs
- RawTextInputReport.cs
- DashStyle.cs
- CustomAttributeBuilder.cs
- InstanceCreationEditor.cs
- StyleBamlTreeBuilder.cs
- CapabilitiesSection.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- RouteCollection.cs
- RSAOAEPKeyExchangeFormatter.cs
- DataGridViewSelectedRowCollection.cs
- columnmapkeybuilder.cs
- SamlSubject.cs
- CultureInfo.cs
- CreateCardRequest.cs