Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / Run.cs / 1 / Run.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // Description: Run class - Text node in Flow content (text run) // //--------------------------------------------------------------------------- using MS.Internal; // Invariant.Assert using System.Windows.Markup; // ContentProperty namespace System.Windows.Documents { ////// A terminal element in text flow hierarchy - contains a uniformatted run of unicode characters /// [ContentProperty("Text")] public class Run : Inline { //------------------------------------------------------------------- // // Constructors // //------------------------------------------------------------------- #region Constructors ////// Initializes an instance of Run class. /// public Run() { } ////// Initializes an instance of Run class specifying its text content. /// /// /// Text content assigned to the Run. /// public Run(string text) : this(text, null) { } ////// Creates a new Run instance. /// /// /// Optional text content. May be null. /// /// /// Optional position at which to insert the new Run. May /// be null. /// public Run(string text, TextPointer insertionPosition) { if (insertionPosition != null) { insertionPosition.TextContainer.BeginChange(); } try { if (insertionPosition != null) { // This will throw InvalidOperationException if schema validity is violated. insertionPosition.InsertInline(this); } if (text != null) { // Do not use Text property as it has perf impact on parser. this.ContentStart.InsertTextInRun(text); } } finally { if (insertionPosition != null) { insertionPosition.TextContainer.EndChange(); } } } #endregion Constructors //-------------------------------------------------------------------- // // Public Properties // //------------------------------------------------------------------- #region Public Properties ////// The content spanned by this TextElement. /// public string Text { get { return TextRangeBase.GetTextInternal(this.ContentStart, this.ContentEnd); } set { if (value == null) { value = String.Empty; } TextContainer textContainer = this.TextContainer; textContainer.BeginChange(); try { TextPointer contentStart = this.ContentStart; if (!this.IsEmpty) { textContainer.DeleteContentInternal(contentStart, this.ContentEnd); } contentStart.InsertTextInRun(value); } finally { textContainer.EndChange(); } } } #endregion Public Properties //-------------------------------------------------------------------- // // Internal Methods // //-------------------------------------------------------------------- #region Internal Methods // // This property // 1. Finds the correct initial size for the _effectiveValues store on the current DependencyObject // 2. This is a performance optimization // internal override int EffectiveValuesInitialSize { get { return 13; } } ////// This method is used by TypeDescriptor to determine if this property should /// be serialized. /// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public bool ShouldSerializeText(XamlDesignerSerializationManager manager) { return manager != null && manager.XmlWriter == null; } #endregion Internal Methods } } // 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
- HierarchicalDataTemplate.cs
- httpstaticobjectscollection.cs
- FormViewModeEventArgs.cs
- ToolboxItemFilterAttribute.cs
- ObjectPersistData.cs
- ProxyFragment.cs
- ModelVisual3D.cs
- DocumentEventArgs.cs
- MenuItem.cs
- StyleHelper.cs
- ObjectCacheHost.cs
- ServiceNameElement.cs
- SectionInformation.cs
- UDPClient.cs
- TriState.cs
- FormsAuthenticationEventArgs.cs
- AuthorizationSection.cs
- Privilege.cs
- CompositionAdorner.cs
- ParameterBuilder.cs
- DomNameTable.cs
- PrintPreviewDialog.cs
- ScriptingJsonSerializationSection.cs
- ReliableOutputConnection.cs
- ValueSerializerAttribute.cs
- FieldTemplateUserControl.cs
- x509utils.cs
- DynamicActivityProperty.cs
- XmlNodeChangedEventManager.cs
- XmlNodeWriter.cs
- RelationshipWrapper.cs
- ProgressBarBrushConverter.cs
- DataServiceEntityAttribute.cs
- ArraySet.cs
- CompilerLocalReference.cs
- PositiveTimeSpanValidator.cs
- DesignerCategoryAttribute.cs
- FakeModelItemImpl.cs
- ListManagerBindingsCollection.cs
- PropertyTab.cs
- InputBinding.cs
- RoutedEventValueSerializer.cs
- WebExceptionStatus.cs
- DeflateInput.cs
- HwndTarget.cs
- XsdValidatingReader.cs
- SignedPkcs7.cs
- ColorMatrix.cs
- SchemaCollectionPreprocessor.cs
- GroupItem.cs
- MessageDecoder.cs
- WorkflowInstanceTerminatedRecord.cs
- XmlSchemaIdentityConstraint.cs
- Content.cs
- RowParagraph.cs
- WeakEventTable.cs
- Environment.cs
- XmlNullResolver.cs
- MailBnfHelper.cs
- DataServiceHost.cs
- ListViewDataItem.cs
- Html32TextWriter.cs
- OdbcFactory.cs
- QEncodedStream.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- WebBrowserNavigatingEventHandler.cs
- BamlLocalizationDictionary.cs
- MultiView.cs
- ImportContext.cs
- AdCreatedEventArgs.cs
- TrackBarRenderer.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- MissingMemberException.cs
- UrlPath.cs
- TreeView.cs
- KeyValuePair.cs
- DataGridViewCellStateChangedEventArgs.cs
- Point.cs
- RunClient.cs
- SortAction.cs
- CharConverter.cs
- SiteMapDataSource.cs
- BitmapFrameEncode.cs
- ICollection.cs
- TagPrefixInfo.cs
- RegexMatch.cs
- IChannel.cs
- MarkupObject.cs
- CSharpCodeProvider.cs
- EntityConnectionStringBuilder.cs
- DataColumnPropertyDescriptor.cs
- DataGridViewRowCollection.cs
- _ListenerRequestStream.cs
- WmlValidatorAdapter.cs
- RequestTimeoutManager.cs
- SHA1Managed.cs
- OleDbDataReader.cs
- XmlBindingWorker.cs
- CustomErrorsSection.cs
- ParseHttpDate.cs