Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / FontFamilyValueSerializer.cs / 1 / FontFamilyValueSerializer.cs
//+------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2002 // // File: FontFamilyValueSerializer.cs // // Contents: FontFamilyValueSerializer implementation // // Created: 6-20-2005 Chuck Jazdzewski (chuckj) // //----------------------------------------------------------------------- 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DoubleCollectionValueSerializer.cs
- Transform3D.cs
- Attributes.cs
- ContentOperations.cs
- DrawItemEvent.cs
- OutOfMemoryException.cs
- ParameterSubsegment.cs
- PersonalizationProviderHelper.cs
- BamlRecordReader.cs
- ObjectTypeMapping.cs
- ShimAsPublicXamlType.cs
- ActivityDesignerHelper.cs
- Vector3D.cs
- UnmanagedMemoryStream.cs
- ListViewItemMouseHoverEvent.cs
- OutputCacheModule.cs
- ToolStripItemRenderEventArgs.cs
- ContextMenuStripGroup.cs
- ReaderWriterLockWrapper.cs
- TextTreeText.cs
- SqlDataSourceView.cs
- DbTransaction.cs
- CustomBindingCollectionElement.cs
- LineServicesRun.cs
- TableMethodGenerator.cs
- WindowsTokenRoleProvider.cs
- StrongTypingException.cs
- ValueConversionAttribute.cs
- KeyedCollection.cs
- GlyphRun.cs
- QilSortKey.cs
- WinFormsSpinner.cs
- SafeHandles.cs
- DataGridViewSelectedCellCollection.cs
- ExceptionValidationRule.cs
- BitArray.cs
- CacheMemory.cs
- TextBoxRenderer.cs
- XmlSchemaComplexType.cs
- StateDesigner.Helpers.cs
- BinaryVersion.cs
- prefixendpointaddressmessagefilter.cs
- TraceHwndHost.cs
- PermissionRequestEvidence.cs
- InlineObject.cs
- ProgressBarBrushConverter.cs
- WsdlImporterElementCollection.cs
- TextBoxBase.cs
- ColorBlend.cs
- XmlSchemaImporter.cs
- Selection.cs
- ProxyWebPartManagerDesigner.cs
- DBBindings.cs
- XmlCountingReader.cs
- HierarchicalDataSourceConverter.cs
- ListViewPagedDataSource.cs
- SortDescriptionCollection.cs
- TypeResolver.cs
- XmlSchemaSearchPattern.cs
- DetailsView.cs
- GridViewUpdatedEventArgs.cs
- DesignerAutoFormat.cs
- Bits.cs
- PositiveTimeSpanValidator.cs
- DbConnectionClosed.cs
- FormattedText.cs
- TreeViewImageIndexConverter.cs
- SetterBaseCollection.cs
- ChannelTerminatedException.cs
- Container.cs
- Size3D.cs
- CheckBoxRenderer.cs
- XmlTextAttribute.cs
- OutputCacheProfileCollection.cs
- OpenFileDialog.cs
- DateTimeSerializationSection.cs
- securestring.cs
- DefaultPropertyAttribute.cs
- ZipPackagePart.cs
- XmlObjectSerializerWriteContextComplex.cs
- Qualifier.cs
- ObjectStorage.cs
- XmlSchemaCollection.cs
- HttpConfigurationSystem.cs
- NativeActivityContext.cs
- Vector3DAnimationBase.cs
- TreeNodeMouseHoverEvent.cs
- BezierSegment.cs
- ProxyBuilder.cs
- KeyboardDevice.cs
- _NegotiateClient.cs
- IDReferencePropertyAttribute.cs
- Win32SafeHandles.cs
- ConsumerConnectionPointCollection.cs
- DataObjectMethodAttribute.cs
- RuleSetCollection.cs
- TdsEnums.cs
- ListDataBindEventArgs.cs
- XmlWhitespace.cs
- DefaultShape.cs