Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Media / TextOptions.cs / 1305600 / TextOptions.cs
//---------------------------------------------------------------------------- // // Copyright(C) Microsoft Corporation. All rights reserved. // // File: TextOptions.cs // // Description: TextOptions groups attached properties that affect the way // WPF displays text such as TextFormattingMode // and TextRenderingMode. // // History: // 05/05/2009 : [....] - created. // //--------------------------------------------------------------------------- using System.Windows; using MS.Internal.Media; namespace System.Windows.Media { ////// Provide access to text options of element in syntax of TextOptions.xxx = yyy; /// Actual data is stored in the owner. /// public static class TextOptions { #region Dependency Properties ///Text formatting mode Property public static readonly DependencyProperty TextFormattingModeProperty = DependencyProperty.RegisterAttached( "TextFormattingMode", typeof(TextFormattingMode), typeof(TextOptions), new FrameworkPropertyMetadata( TextFormattingMode.Ideal, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits), new ValidateValueCallback(IsTextFormattingModeValid)); internal static bool IsTextFormattingModeValid(object valueObject) { TextFormattingMode value = (TextFormattingMode) valueObject; return (value == TextFormattingMode.Ideal) || (value == TextFormattingMode.Display); } ///Text rendering Property public static readonly DependencyProperty TextRenderingModeProperty = DependencyProperty.RegisterAttached( "TextRenderingMode", typeof(TextRenderingMode), typeof(TextOptions), new FrameworkPropertyMetadata( TextRenderingMode.Auto, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits), new ValidateValueCallback(System.Windows.Media.ValidateEnums.IsTextRenderingModeValid)); ///Text hinting property public static readonly DependencyProperty TextHintingModeProperty = TextOptionsInternal.TextHintingModeProperty.AddOwner( typeof(TextOptions)); #endregion Dependency Properties #region Attached Properties Setters public static void SetTextFormattingMode(DependencyObject element, TextFormattingMode value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(TextFormattingModeProperty, value); } public static TextFormattingMode GetTextFormattingMode(DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return (TextFormattingMode)element.GetValue(TextFormattingModeProperty); } public static void SetTextRenderingMode(DependencyObject element, TextRenderingMode value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(TextRenderingModeProperty, value); } public static TextRenderingMode GetTextRenderingMode(DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return (TextRenderingMode)element.GetValue(TextRenderingModeProperty); } public static void SetTextHintingMode(DependencyObject element, TextHintingMode value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(TextHintingModeProperty, value); } public static TextHintingMode GetTextHintingMode(DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return (TextHintingMode)element.GetValue(TextHintingModeProperty); } #endregion Attached Properties Getters and Setters } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright(C) Microsoft Corporation. All rights reserved. // // File: TextOptions.cs // // Description: TextOptions groups attached properties that affect the way // WPF displays text such as TextFormattingMode // and TextRenderingMode. // // History: // 05/05/2009 : [....] - created. // //--------------------------------------------------------------------------- using System.Windows; using MS.Internal.Media; namespace System.Windows.Media { ////// Provide access to text options of element in syntax of TextOptions.xxx = yyy; /// Actual data is stored in the owner. /// public static class TextOptions { #region Dependency Properties ///Text formatting mode Property public static readonly DependencyProperty TextFormattingModeProperty = DependencyProperty.RegisterAttached( "TextFormattingMode", typeof(TextFormattingMode), typeof(TextOptions), new FrameworkPropertyMetadata( TextFormattingMode.Ideal, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits), new ValidateValueCallback(IsTextFormattingModeValid)); internal static bool IsTextFormattingModeValid(object valueObject) { TextFormattingMode value = (TextFormattingMode) valueObject; return (value == TextFormattingMode.Ideal) || (value == TextFormattingMode.Display); } ///Text rendering Property public static readonly DependencyProperty TextRenderingModeProperty = DependencyProperty.RegisterAttached( "TextRenderingMode", typeof(TextRenderingMode), typeof(TextOptions), new FrameworkPropertyMetadata( TextRenderingMode.Auto, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits), new ValidateValueCallback(System.Windows.Media.ValidateEnums.IsTextRenderingModeValid)); ///Text hinting property public static readonly DependencyProperty TextHintingModeProperty = TextOptionsInternal.TextHintingModeProperty.AddOwner( typeof(TextOptions)); #endregion Dependency Properties #region Attached Properties Setters public static void SetTextFormattingMode(DependencyObject element, TextFormattingMode value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(TextFormattingModeProperty, value); } public static TextFormattingMode GetTextFormattingMode(DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return (TextFormattingMode)element.GetValue(TextFormattingModeProperty); } public static void SetTextRenderingMode(DependencyObject element, TextRenderingMode value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(TextRenderingModeProperty, value); } public static TextRenderingMode GetTextRenderingMode(DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return (TextRenderingMode)element.GetValue(TextRenderingModeProperty); } public static void SetTextHintingMode(DependencyObject element, TextHintingMode value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(TextHintingModeProperty, value); } public static TextHintingMode GetTextHintingMode(DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return (TextHintingMode)element.GetValue(TextHintingModeProperty); } #endregion Attached Properties Getters and Setters } } // 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
- PassportAuthentication.cs
- CommandHelpers.cs
- sqlmetadatafactory.cs
- TextEndOfLine.cs
- DbParameterCollection.cs
- PropertyIDSet.cs
- Mapping.cs
- GridViewAutoFormat.cs
- AuthenticationModuleElement.cs
- SqlDataSourceCache.cs
- DependencyObjectValidator.cs
- SqlUserDefinedTypeAttribute.cs
- ComplusTypeValidator.cs
- CustomPopupPlacement.cs
- ping.cs
- DateTimeFormatInfo.cs
- CodeVariableReferenceExpression.cs
- WebAdminConfigurationHelper.cs
- SessionStateContainer.cs
- _NegotiateClient.cs
- HwndProxyElementProvider.cs
- XsltArgumentList.cs
- SettingsPropertyNotFoundException.cs
- FontWeight.cs
- VectorCollectionValueSerializer.cs
- ObjectAssociationEndMapping.cs
- DependencyObjectPropertyDescriptor.cs
- GridItem.cs
- ThousandthOfEmRealDoubles.cs
- Constant.cs
- HttpSysSettings.cs
- ImageClickEventArgs.cs
- XXXInfos.cs
- DataGridCaption.cs
- FloaterBaseParagraph.cs
- _NegoStream.cs
- EventItfInfo.cs
- UntrustedRecipientException.cs
- WindowsSysHeader.cs
- FlowLayoutSettings.cs
- SecondaryIndexDefinition.cs
- SQLString.cs
- TypeLoadException.cs
- HandleCollector.cs
- SqlCachedBuffer.cs
- HostVisual.cs
- ToolStripStatusLabel.cs
- QualifiedId.cs
- CommunicationObjectAbortedException.cs
- AnchoredBlock.cs
- Column.cs
- XmlCompatibilityReader.cs
- DataGrid.cs
- CodeTypeOfExpression.cs
- GeneralTransform3D.cs
- MexBindingBindingCollectionElement.cs
- LayoutInformation.cs
- TextDecorationCollectionConverter.cs
- PageSettings.cs
- EventListener.cs
- SiteMap.cs
- TextFormatter.cs
- ToolstripProfessionalRenderer.cs
- SoapCommonClasses.cs
- LogArchiveSnapshot.cs
- CachedFontFace.cs
- HandleRef.cs
- ToolStripGripRenderEventArgs.cs
- SecurityKeyIdentifierClause.cs
- ProviderUtil.cs
- AnchoredBlock.cs
- DurableInstanceProvider.cs
- SuppressIldasmAttribute.cs
- OperationFormatUse.cs
- OleDbParameter.cs
- SmtpFailedRecipientException.cs
- AccessedThroughPropertyAttribute.cs
- CompositeScriptReference.cs
- DecimalMinMaxAggregationOperator.cs
- RichTextBox.cs
- PageFunction.cs
- LocationSectionRecord.cs
- StringValidator.cs
- SqlDataSourceStatusEventArgs.cs
- ExtractorMetadata.cs
- GenericFlowSwitchHelper.cs
- _BufferOffsetSize.cs
- ShapingEngine.cs
- dsa.cs
- InkSerializer.cs
- AssociationSetMetadata.cs
- HelpOperationInvoker.cs
- GestureRecognitionResult.cs
- DocumentsTrace.cs
- MetadataArtifactLoaderCompositeResource.cs
- ProviderIncompatibleException.cs
- OrderedDictionaryStateHelper.cs
- WebPartTracker.cs
- SafeWaitHandle.cs
- SelectionChangedEventArgs.cs