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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ReflectPropertyDescriptor.cs
- DomNameTable.cs
- WmlControlAdapter.cs
- GorillaCodec.cs
- InputLanguageManager.cs
- VarRefManager.cs
- XPathMessageFilterTable.cs
- ProviderUtil.cs
- GPStream.cs
- DrawingContextDrawingContextWalker.cs
- CompiledELinqQueryState.cs
- SimpleRecyclingCache.cs
- ScrollPattern.cs
- DataListCommandEventArgs.cs
- ToggleButton.cs
- ValueTable.cs
- ConfigsHelper.cs
- translator.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ExpressionHelper.cs
- ParallelLoopState.cs
- ToolStripDropDown.cs
- PermissionAttributes.cs
- FillErrorEventArgs.cs
- ConnectionsZoneAutoFormat.cs
- TableParagraph.cs
- TargetControlTypeAttribute.cs
- InvalidComObjectException.cs
- RegexMatch.cs
- WpfPayload.cs
- RequiredFieldValidator.cs
- OracleBoolean.cs
- EventLog.cs
- ButtonBase.cs
- WizardPanelChangingEventArgs.cs
- JoinGraph.cs
- BamlBinaryWriter.cs
- WindowsListViewScroll.cs
- DecimalConstantAttribute.cs
- SqlBooleanMismatchVisitor.cs
- FrameworkTemplate.cs
- BasicCellRelation.cs
- TextDecorationUnitValidation.cs
- DynamicQueryStringParameter.cs
- Operator.cs
- Token.cs
- OpacityConverter.cs
- WorkflowServiceInstance.cs
- EventLogPermissionAttribute.cs
- CodeLabeledStatement.cs
- XmlToDatasetMap.cs
- EventInfo.cs
- MediaSystem.cs
- WorkflowIdleBehavior.cs
- XmlSchemaNotation.cs
- SchemaMapping.cs
- Memoizer.cs
- PassportPrincipal.cs
- ClickablePoint.cs
- LiteralDesigner.cs
- XPathParser.cs
- TimestampInformation.cs
- MemberAssignmentAnalysis.cs
- EntityRecordInfo.cs
- SqlDataSourceRefreshSchemaForm.cs
- ExpressionConverter.cs
- RC2CryptoServiceProvider.cs
- WinFormsComponentEditor.cs
- BufferedReceiveElement.cs
- _Events.cs
- EventMap.cs
- CompositeTypefaceMetrics.cs
- Utils.cs
- AutoGeneratedFieldProperties.cs
- ActivityTypeDesigner.xaml.cs
- DocumentViewerAutomationPeer.cs
- EdmMember.cs
- ProfileBuildProvider.cs
- PropertyRef.cs
- DataGridTemplateColumn.cs
- WorkflowMarkupElementEventArgs.cs
- NoClickablePointException.cs
- RegisteredScript.cs
- WebColorConverter.cs
- BCLDebug.cs
- HtmlFormWrapper.cs
- UniqueSet.cs
- SafeHandles.cs
- CultureSpecificStringDictionary.cs
- SqlNodeAnnotation.cs
- MimeWriter.cs
- ProfileEventArgs.cs
- FillBehavior.cs
- ImportCatalogPart.cs
- UserPersonalizationStateInfo.cs
- GeometryHitTestResult.cs
- DrawItemEvent.cs
- RTTrackingProfile.cs
- GuidelineCollection.cs
- GenericRootAutomationPeer.cs