Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / FontFamilyValueSerializer.cs / 1305600 / FontFamilyValueSerializer.cs
//+------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2002 // // File: FontFamilyValueSerializer.cs // // Contents: FontFamilyValueSerializer implementation // // Created: 6-20-2005 Chuck Jazdzewski ([....]) // //----------------------------------------------------------------------- using System.ComponentModel; using System.Globalization; using System.Windows.Markup; // Allow suppression of presharp warnings #pragma warning disable 1634, 1691 namespace System.Windows.Media { ////// Serializer for a FontFamily /// public class FontFamilyValueSerializer: ValueSerializer { ////// Returns true. FontFamilyValueSerializer can always convert from a string. /// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } ////// Creates a FontFamily from a string /// public override object ConvertFromString(string value, IValueSerializerContext context) { if (string.IsNullOrEmpty(value)) { throw GetConvertFromException(value); } return new FontFamily(value); } ////// Returns true if the FontFamily is a named font family. /// public override bool CanConvertToString(object value, IValueSerializerContext context) { FontFamily fontFamily = value as FontFamily; // Suppress PRESharp warning that fontFamily can be null; apparently PRESharp // doesn't understand short circuit evaluation of operator &&. #pragma warning suppress 56506 return fontFamily != null && fontFamily.Source != null && fontFamily.Source.Length != 0; } ////// Converts a font family to a string. /// public override string ConvertToString(object value, IValueSerializerContext context) { FontFamily fontFamily = value as FontFamily; if (fontFamily == null || fontFamily.Source == null) throw GetConvertToException(value, typeof(string)); return fontFamily.Source; } } } // 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
- ToolboxItemCollection.cs
- PrimaryKeyTypeConverter.cs
- TypedTableBase.cs
- String.cs
- TableCell.cs
- FixedDSBuilder.cs
- CacheAxisQuery.cs
- Configuration.cs
- QuaternionConverter.cs
- MetadataCollection.cs
- ZipIOModeEnforcingStream.cs
- IdentifierCollection.cs
- EventData.cs
- XmlAttributeCollection.cs
- TextShapeableCharacters.cs
- NamespaceList.cs
- TemplateInstanceAttribute.cs
- MsmqBindingMonitor.cs
- Preprocessor.cs
- HealthMonitoringSection.cs
- PngBitmapEncoder.cs
- QueryAccessibilityHelpEvent.cs
- ReadOnlyAttribute.cs
- ExpressionHelper.cs
- LongValidator.cs
- PropertyChangeTracker.cs
- Stylesheet.cs
- SerializationEventsCache.cs
- HtmlLink.cs
- ItemMap.cs
- ToolboxItemLoader.cs
- SqlCacheDependencySection.cs
- UnauthorizedWebPart.cs
- StrokeNode.cs
- ProfileManager.cs
- Vector3dCollection.cs
- RemoteWebConfigurationHostServer.cs
- ManipulationDelta.cs
- LineServicesRun.cs
- HasCopySemanticsAttribute.cs
- DataPagerCommandEventArgs.cs
- ClientBuildManager.cs
- SchemaElement.cs
- SourceElementsCollection.cs
- FutureFactory.cs
- BindStream.cs
- CaseCqlBlock.cs
- MessageEnumerator.cs
- ActionFrame.cs
- LifetimeServices.cs
- ConstructorNeedsTagAttribute.cs
- CollectionViewGroupRoot.cs
- TabControl.cs
- BamlCollectionHolder.cs
- TemplateXamlTreeBuilder.cs
- CompiledQueryCacheEntry.cs
- TextDecorationUnitValidation.cs
- Single.cs
- Viewport2DVisual3D.cs
- EntityConnectionStringBuilderItem.cs
- ArithmeticException.cs
- ItemsControl.cs
- CacheDependency.cs
- SpellerInterop.cs
- RotateTransform.cs
- KnownTypesHelper.cs
- SourceItem.cs
- PolicyManager.cs
- WmpBitmapEncoder.cs
- GridItemProviderWrapper.cs
- DataGridItemCollection.cs
- GenerateTemporaryTargetAssembly.cs
- Quaternion.cs
- CultureTableRecord.cs
- EntityConnectionStringBuilder.cs
- OptimalTextSource.cs
- XpsDigitalSignature.cs
- VisualStyleTypesAndProperties.cs
- HtmlInputButton.cs
- CollectionChangedEventManager.cs
- OneWayChannelListener.cs
- FilterInvalidBodyAccessException.cs
- PartitionResolver.cs
- MemoryStream.cs
- OutputCacheSettingsSection.cs
- ObjectToModelValueConverter.cs
- OleDbCommandBuilder.cs
- WmlCommandAdapter.cs
- LinkClickEvent.cs
- Transform.cs
- HtmlToClrEventProxy.cs
- COM2Enum.cs
- KnowledgeBase.cs
- CaretElement.cs
- SubclassTypeValidator.cs
- TypeDescriptionProvider.cs
- AutomationElementCollection.cs
- DbProviderFactories.cs
- DefaultProxySection.cs
- GridViewSelectEventArgs.cs