Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Base / System / Windows / DependencyPropertyValueSerializer.cs / 1 / DependencyPropertyValueSerializer.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: CommandValueSerializer.cs // // Contents: ValueSerializer for DependencyProperty // // Created: 04/28/2005 chuckj // //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.Windows.Markup; namespace System.Windows { internal class DependencyPropertyValueSerializer : ValueSerializer { public override bool CanConvertToString(object value, IValueSerializerContext context) { return ValueSerializer.GetSerializerFor(typeof(Type), context) != null; } public override bool CanConvertFromString(string value, IValueSerializerContext context) { return ValueSerializer.GetSerializerFor(typeof(Type), context) != null; } public override string ConvertToString(object value, IValueSerializerContext context) { DependencyProperty property = value as DependencyProperty; if (property != null) { ValueSerializer typeSerializer = ValueSerializer.GetSerializerFor(typeof(Type), context); if (typeSerializer != null) { return typeSerializer.ConvertToString(property.OwnerType, context) + "." + property.Name; } } throw GetConvertToException(value, typeof(string)); } public override IEnumerableTypeReferences(object value, IValueSerializerContext context) { DependencyProperty property = value as DependencyProperty; if (property != null) { return new Type[] { property.OwnerType }; } else { return base.TypeReferences(value, context); } } public override object ConvertFromString(string value, IValueSerializerContext context) { ValueSerializer typeSerializer = ValueSerializer.GetSerializerFor(typeof(Type), context); if (typeSerializer != null) { int dotIndex = value.IndexOf('.'); if (dotIndex >= 0) { string typeName = value.Substring(0, dotIndex - 1); Type ownerType = typeSerializer.ConvertFromString(typeName, context) as Type; if (ownerType != null) { return DependencyProperty.FromName(typeName, ownerType); } } } throw GetConvertFromException(value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PopupRootAutomationPeer.cs
- ServiceContractListItem.cs
- XsdBuilder.cs
- GACIdentityPermission.cs
- BasicCommandTreeVisitor.cs
- controlskin.cs
- UrlMapping.cs
- ChannelServices.cs
- OutputScope.cs
- DbFunctionCommandTree.cs
- BitmapEffectGroup.cs
- MemberProjectedSlot.cs
- WindowsClientElement.cs
- PopOutPanel.cs
- BitmapEffectInputConnector.cs
- WorkingDirectoryEditor.cs
- Point.cs
- GridViewRow.cs
- cryptoapiTransform.cs
- FieldTemplateFactory.cs
- WindowsSolidBrush.cs
- TextBounds.cs
- TemplateLookupAction.cs
- Int32Collection.cs
- ObjectDataSourceFilteringEventArgs.cs
- SimpleParser.cs
- FlowDecisionDesigner.xaml.cs
- ipaddressinformationcollection.cs
- IconEditor.cs
- StateBag.cs
- MatrixStack.cs
- Boolean.cs
- TextParentUndoUnit.cs
- ColorBlend.cs
- SchemaNotation.cs
- ExtensionFile.cs
- HttpResponse.cs
- VirtualPathUtility.cs
- HtmlInputControl.cs
- TextEditorMouse.cs
- FileSecurity.cs
- MediaElement.cs
- ToolStripDropDownButton.cs
- exports.cs
- SqlOuterApplyReducer.cs
- RegexCharClass.cs
- NumericUpDownAccelerationCollection.cs
- SelectedDatesCollection.cs
- InvalidProgramException.cs
- Queue.cs
- PropertyInformation.cs
- OrderPreservingSpoolingTask.cs
- PackageFilter.cs
- RewritingProcessor.cs
- UIElement3D.cs
- ListSortDescriptionCollection.cs
- DocumentPaginator.cs
- SvcMapFileLoader.cs
- RequestCache.cs
- BooleanExpr.cs
- Stroke2.cs
- ObjectPersistData.cs
- RectValueSerializer.cs
- Attributes.cs
- EntryWrittenEventArgs.cs
- SessionStateUtil.cs
- HtmlShimManager.cs
- ConfigurationManager.cs
- HostTimeoutsElement.cs
- ObjectTag.cs
- AnnotationStore.cs
- CriticalFinalizerObject.cs
- DataGridViewComponentPropertyGridSite.cs
- UtilityExtension.cs
- LabelExpression.cs
- Stackframe.cs
- IsolatedStorageFileStream.cs
- HebrewNumber.cs
- BaseCAMarshaler.cs
- TransactionScope.cs
- EntitySqlQueryBuilder.cs
- CompilerGeneratedAttribute.cs
- CommandTreeTypeHelper.cs
- ClockController.cs
- CompiledELinqQueryState.cs
- Image.cs
- PointCollectionValueSerializer.cs
- OleDbParameterCollection.cs
- SafeCertificateStore.cs
- LineSegment.cs
- GridView.cs
- EnumerableCollectionView.cs
- ModelPropertyImpl.cs
- _LocalDataStore.cs
- EndpointFilterProvider.cs
- ToolStripStatusLabel.cs
- ProxyWebPartConnectionCollection.cs
- WebPartUtil.cs
- DefaultBindingPropertyAttribute.cs
- TraceListener.cs