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
- CssStyleCollection.cs
- PagePropertiesChangingEventArgs.cs
- TextRangeProviderWrapper.cs
- dbenumerator.cs
- Vector3dCollection.cs
- WaitHandleCannotBeOpenedException.cs
- ReliableSession.cs
- ConstructorNeedsTagAttribute.cs
- IPEndPoint.cs
- TextEditorCopyPaste.cs
- HyperLink.cs
- GroupStyle.cs
- XmlWriter.cs
- AnnotationObservableCollection.cs
- TemplateControl.cs
- PageFunction.cs
- DataException.cs
- CheckBox.cs
- RepeatBehavior.cs
- RightsManagementInformation.cs
- Exception.cs
- DataSourceGeneratorException.cs
- OleServicesContext.cs
- Pen.cs
- ExpandoObject.cs
- TypeBuilderInstantiation.cs
- LogReserveAndAppendState.cs
- OrderedEnumerableRowCollection.cs
- CharAnimationUsingKeyFrames.cs
- ToolStripRendererSwitcher.cs
- SecurityHelper.cs
- TimeSpanValidator.cs
- ThreadSafeList.cs
- BindingExpression.cs
- ForwardPositionQuery.cs
- ContainsRowNumberChecker.cs
- ColumnMapVisitor.cs
- SmtpTransport.cs
- BuildManagerHost.cs
- PathGradientBrush.cs
- FlowchartDesignerCommands.cs
- StylusButtonEventArgs.cs
- Hex.cs
- XmlReaderSettings.cs
- FindSimilarActivitiesVerb.cs
- DataGridViewColumn.cs
- PointValueSerializer.cs
- ThreadExceptionDialog.cs
- CodeTypeMember.cs
- LostFocusEventManager.cs
- WindowsPrincipal.cs
- DataControlImageButton.cs
- SourceFileInfo.cs
- FileStream.cs
- VariantWrapper.cs
- ExecutorLocksHeldException.cs
- Vector.cs
- WebControlsSection.cs
- ProcessModelSection.cs
- IItemContainerGenerator.cs
- Int32.cs
- EncodingTable.cs
- EmptyStringExpandableObjectConverter.cs
- CrossSiteScriptingValidation.cs
- X500Name.cs
- XPathDocumentIterator.cs
- ListItemsPage.cs
- NodeLabelEditEvent.cs
- XmlSchemaIdentityConstraint.cs
- ValidatorCollection.cs
- BuildResultCache.cs
- BaseInfoTable.cs
- TextParagraphView.cs
- ContentElement.cs
- PipeStream.cs
- AutoGeneratedField.cs
- WebServiceClientProxyGenerator.cs
- TextSelectionHighlightLayer.cs
- TrailingSpaceComparer.cs
- SafeRightsManagementQueryHandle.cs
- DesignerSerializationOptionsAttribute.cs
- DataServiceQueryException.cs
- PageRequestManager.cs
- AttributeParameterInfo.cs
- SpecularMaterial.cs
- SafeViewOfFileHandle.cs
- Formatter.cs
- CodeArrayCreateExpression.cs
- DropDownButton.cs
- CopyOnWriteList.cs
- GridViewSortEventArgs.cs
- PointValueSerializer.cs
- CreateUserWizardDesigner.cs
- TextProperties.cs
- ConnectionStringsSection.cs
- BuildProvidersCompiler.cs
- DataServiceSaveChangesEventArgs.cs
- DataSetSchema.cs
- DataRecordObjectView.cs
- Debug.cs