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
- EditingCommands.cs
- AspCompat.cs
- OleDbSchemaGuid.cs
- GradientStop.cs
- ResourceDescriptionAttribute.cs
- DataSourceCache.cs
- IRCollection.cs
- COM2EnumConverter.cs
- DuplexClientBase.cs
- InkCanvasSelection.cs
- NumericExpr.cs
- Group.cs
- StructuralCache.cs
- DelimitedListTraceListener.cs
- CompositeFontInfo.cs
- TcpConnectionPoolSettingsElement.cs
- InvokeBase.cs
- log.cs
- ServiceContractDetailViewControl.cs
- TreeNodeClickEventArgs.cs
- TreeView.cs
- XmlAttributes.cs
- Package.cs
- CmsInterop.cs
- ProtocolsConfiguration.cs
- LineGeometry.cs
- NullReferenceException.cs
- InternalTransaction.cs
- ActivityMarkupSerializer.cs
- SmtpReplyReaderFactory.cs
- FileFormatException.cs
- TransactionException.cs
- safelink.cs
- InvariantComparer.cs
- StorageRoot.cs
- UnknownWrapper.cs
- TranslateTransform3D.cs
- AttributeParameterInfo.cs
- ImageMap.cs
- RtfToXamlReader.cs
- PolygonHotSpot.cs
- ObjectStateFormatter.cs
- CodeAttributeDeclarationCollection.cs
- HandleCollector.cs
- SessionSwitchEventArgs.cs
- VarInfo.cs
- MasterPageParser.cs
- oledbmetadatacolumnnames.cs
- AttributeCollection.cs
- sqlmetadatafactory.cs
- ProfileService.cs
- Crc32.cs
- OraclePermission.cs
- VisualStyleElement.cs
- Encoder.cs
- PageAsyncTaskManager.cs
- EventManager.cs
- OleDbConnectionInternal.cs
- InvokeBase.cs
- GenericWebPart.cs
- WindowsStreamSecurityElement.cs
- CodeExpressionCollection.cs
- SetterBase.cs
- SplitterPanel.cs
- StreamingContext.cs
- EntityTemplateUserControl.cs
- HTTPNotFoundHandler.cs
- WindowsHyperlink.cs
- XPathNavigatorKeyComparer.cs
- SecurityDocument.cs
- PathNode.cs
- SchemaImporter.cs
- XmlHelper.cs
- ISAPIApplicationHost.cs
- EntityDesignerBuildProvider.cs
- PauseStoryboard.cs
- WebPartManager.cs
- Rect3D.cs
- ButtonChrome.cs
- XmlUtf8RawTextWriter.cs
- TablePattern.cs
- ResetableIterator.cs
- PointAnimationUsingKeyFrames.cs
- PieceDirectory.cs
- ActivatableWorkflowsQueryResult.cs
- Point3DValueSerializer.cs
- DelegatedStream.cs
- PatternMatcher.cs
- CaseInsensitiveOrdinalStringComparer.cs
- StrokeNodeOperations.cs
- SqlCacheDependencySection.cs
- KeyedHashAlgorithm.cs
- ClientScriptManager.cs
- MediaEntryAttribute.cs
- KeyTimeConverter.cs
- PermissionAttributes.cs
- GridViewRowEventArgs.cs
- CryptoApi.cs
- DynamicControlParameter.cs
- SystemGatewayIPAddressInformation.cs