Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Automation / Peers / DocumentViewerBaseAutomationPeer.cs / 1 / DocumentViewerBaseAutomationPeer.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: DocumentViewerBaseAutomationPeer.cs // // Description: AutomationPeer associated with DocumentViewerBase. // //--------------------------------------------------------------------------- using System.Collections.Generic; // Listusing System.Windows.Controls.Primitives; // DocumentViewerBase using System.Windows.Documents; // IDocumentPaginatorSource namespace System.Windows.Automation.Peers { /// /// AutomationPeer associated with DocumentViewerBase. /// public class DocumentViewerBaseAutomationPeer : FrameworkElementAutomationPeer { ////// Constructor. /// /// Owner of the AutomationPeer. public DocumentViewerBaseAutomationPeer(DocumentViewerBase owner) : base(owner) { } ////// public override object GetPattern(PatternInterface patternInterface) { object returnValue = null; if (patternInterface == PatternInterface.Text) { // Make sure that Automation children are created. this.GetChildren(); // Re-expose TextPattern from hosted document. if (_documentPeer != null) { _documentPeer.EventsSource = this; returnValue = _documentPeer.GetPattern(patternInterface); } } return returnValue; } ////// /// ////// /// AutomationPeer associated with DocumentViewerBase returns an AutomationPeer /// for hosted Document and for elements in the style. /// protected override ListGetChildrenCore() { // Get children for all elements in the style. List children = base.GetChildrenCore(); // Add AutomationPeer associated with the document. // Make it the first child of the collection. AutomationPeer documentPeer = GetDocumentAutomationPeer(); if (_documentPeer != documentPeer) { if (_documentPeer != null) { _documentPeer.OnDisconnected(); } _documentPeer = documentPeer as DocumentAutomationPeer; } if (documentPeer != null) { if (children == null) { children = new List (); } children.Add(documentPeer); } return children; } /// /// protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Document; } ////// /// protected override string GetClassNameCore() { return "DocumentViewer"; } ////// /// Retrieves AutomationPeer for the document. /// ///private AutomationPeer GetDocumentAutomationPeer() { AutomationPeer documentPeer = null; IDocumentPaginatorSource document = ((DocumentViewerBase)Owner).Document; if (document != null) { if (document is UIElement) { documentPeer = UIElementAutomationPeer.CreatePeerForElement((UIElement)document); } else if (document is ContentElement) { documentPeer = ContentElementAutomationPeer.CreatePeerForElement((ContentElement)document); } } return documentPeer; } private DocumentAutomationPeer _documentPeer; } } // 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
- EmptyQuery.cs
- ExtensionWindowResizeGrip.cs
- ConfigurationManager.cs
- Formatter.cs
- DisplayNameAttribute.cs
- CfgSemanticTag.cs
- FixedSOMContainer.cs
- XpsResource.cs
- RawTextInputReport.cs
- Baml2006SchemaContext.cs
- __ConsoleStream.cs
- Trace.cs
- ApplicationHost.cs
- StrongNameKeyPair.cs
- PrintPageEvent.cs
- BuildProvider.cs
- FrameworkContentElementAutomationPeer.cs
- TypedReference.cs
- SHA384Managed.cs
- IDispatchConstantAttribute.cs
- Int16Converter.cs
- XmlWrappingReader.cs
- Directory.cs
- SmtpTransport.cs
- CustomAttributeSerializer.cs
- InputManager.cs
- TokenBasedSet.cs
- SystemSounds.cs
- WebScriptMetadataMessage.cs
- TagNameToTypeMapper.cs
- Int64.cs
- RealProxy.cs
- DesignerFrame.cs
- ContractReference.cs
- Grid.cs
- CompiledIdentityConstraint.cs
- ActivityDesignerLayoutSerializers.cs
- ScrollBarRenderer.cs
- CalendarTable.cs
- HtmlElementErrorEventArgs.cs
- Currency.cs
- DictionaryContent.cs
- IERequestCache.cs
- XmlSchemaNotation.cs
- CriticalExceptions.cs
- ExtensibleSyndicationObject.cs
- Timer.cs
- ThrowOnMultipleAssignment.cs
- MethodBody.cs
- ObjectKeyFrameCollection.cs
- TableLayoutColumnStyleCollection.cs
- UIntPtr.cs
- SpellerStatusTable.cs
- XmlValueConverter.cs
- NativeCompoundFileAPIs.cs
- UrlPropertyAttribute.cs
- SortDescriptionCollection.cs
- ExpressionBinding.cs
- hebrewshape.cs
- HttpProtocolImporter.cs
- UICuesEvent.cs
- ScriptComponentDescriptor.cs
- LingerOption.cs
- lengthconverter.cs
- DynamicValidator.cs
- TreeNodeCollection.cs
- ChtmlImageAdapter.cs
- bidPrivateBase.cs
- TextServicesPropertyRanges.cs
- SoapProcessingBehavior.cs
- DataGridViewAutoSizeModeEventArgs.cs
- BackgroundFormatInfo.cs
- Rules.cs
- PreservationFileReader.cs
- TraceData.cs
- ResourceSet.cs
- UnsafeNativeMethods.cs
- TypedElement.cs
- SpoolingTask.cs
- LocalizationParserHooks.cs
- GradientStop.cs
- GcHandle.cs
- RC2.cs
- StatusBarItemAutomationPeer.cs
- QilBinary.cs
- JavaScriptSerializer.cs
- DrawingContext.cs
- CombinedGeometry.cs
- OdbcConnectionStringbuilder.cs
- XmlEntityReference.cs
- LocationReference.cs
- Version.cs
- Triangle.cs
- IndentedTextWriter.cs
- QueryStringParameter.cs
- KeyValueSerializer.cs
- DispatcherTimer.cs
- RowCache.cs
- DrawingImage.cs
- TypeConverterHelper.cs