Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / Automation / Peers / TabItemAutomationPeer.cs / 1 / TabItemAutomationPeer.cs
using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class TabItemAutomationPeer : SelectorItemAutomationPeer, ISelectionItemProvider { /// public TabItemAutomationPeer(object owner, TabControlAutomationPeer tabControlAutomationPeer) : base(owner, tabControlAutomationPeer) {} /// override protected string GetClassNameCore() { return "TabItem"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.TabItem; } // Return the base without the AccessKey character /// override protected string GetNameCore() { string result = base.GetNameCore(); if (!string.IsNullOrEmpty(result)) { TabItem tabItem = GetWrapper() as TabItem; if (tabItem.Header is string) { return AccessText.RemoveAccessKeyMarker(result); } } return result; } // Selected TabItem content is located under the TabControl style visual tree /// protected override ListGetChildrenCore() { // Call the base in case we have children in the header List headerChildren = base.GetChildrenCore(); // Only if the TabItem is selected we need to add its visual children TabItem tabItem = GetWrapper() as TabItem; if (tabItem != null && tabItem.IsSelected) { TabControl parentTabControl = ItemsControlAutomationPeer.Owner as TabControl; if (parentTabControl != null) { ContentPresenter contentHost = parentTabControl.SelectedContentPresenter; if (contentHost != null) { AutomationPeer contentHostPeer = new FrameworkElementAutomationPeer(contentHost); List contentChildren = contentHostPeer.GetChildren(); if (contentChildren != null) { if (headerChildren == null) headerChildren = contentChildren; else headerChildren.AddRange(contentChildren); } } } } return headerChildren; } void ISelectionItemProvider.RemoveFromSelection() { if (!IsEnabled()) throw new ElementNotEnabledException(); TabItem tabItem = GetWrapper() as TabItem; if (tabItem.IsSelected) { throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security; using System.Text; using System.Windows; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Interop; using System.Windows.Media; using MS.Internal; using MS.Win32; namespace System.Windows.Automation.Peers { /// public class TabItemAutomationPeer : SelectorItemAutomationPeer, ISelectionItemProvider { /// public TabItemAutomationPeer(object owner, TabControlAutomationPeer tabControlAutomationPeer) : base(owner, tabControlAutomationPeer) {} /// override protected string GetClassNameCore() { return "TabItem"; } /// override protected AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.TabItem; } // Return the base without the AccessKey character /// override protected string GetNameCore() { string result = base.GetNameCore(); if (!string.IsNullOrEmpty(result)) { TabItem tabItem = GetWrapper() as TabItem; if (tabItem.Header is string) { return AccessText.RemoveAccessKeyMarker(result); } } return result; } // Selected TabItem content is located under the TabControl style visual tree /// protected override List GetChildrenCore() { // Call the base in case we have children in the header List headerChildren = base.GetChildrenCore(); // Only if the TabItem is selected we need to add its visual children TabItem tabItem = GetWrapper() as TabItem; if (tabItem != null && tabItem.IsSelected) { TabControl parentTabControl = ItemsControlAutomationPeer.Owner as TabControl; if (parentTabControl != null) { ContentPresenter contentHost = parentTabControl.SelectedContentPresenter; if (contentHost != null) { AutomationPeer contentHostPeer = new FrameworkElementAutomationPeer(contentHost); List contentChildren = contentHostPeer.GetChildren(); if (contentChildren != null) { if (headerChildren == null) headerChildren = contentChildren; else headerChildren.AddRange(contentChildren); } } } } return headerChildren; } void ISelectionItemProvider.RemoveFromSelection() { if (!IsEnabled()) throw new ElementNotEnabledException(); TabItem tabItem = GetWrapper() as TabItem; if (tabItem.IsSelected) { throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed)); } } } } // 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
- ExpressionBuilder.cs
- MsmqActivation.cs
- DetailsViewInsertedEventArgs.cs
- M3DUtil.cs
- UpdatableGenericsFeature.cs
- SpecularMaterial.cs
- GenericArgumentsUpdater.cs
- TextSpanModifier.cs
- PropertySegmentSerializer.cs
- TransactedBatchContext.cs
- DataGridTablesFactory.cs
- OSFeature.cs
- CodeSnippetCompileUnit.cs
- InternalConfigHost.cs
- XmlSchemaAttribute.cs
- EditorBrowsableAttribute.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- BoolExpression.cs
- BackStopAuthenticationModule.cs
- FieldAccessException.cs
- RequestCachingSection.cs
- SqlClientWrapperSmiStream.cs
- Track.cs
- EditorPart.cs
- ResourceDefaultValueAttribute.cs
- SystemNetworkInterface.cs
- UserControl.cs
- BaseParser.cs
- ArglessEventHandlerProxy.cs
- LayoutEvent.cs
- ParameterCollectionEditorForm.cs
- OverrideMode.cs
- ServerReliableChannelBinder.cs
- UnauthorizedAccessException.cs
- ResetableIterator.cs
- LogExtent.cs
- HtmlAnchor.cs
- Delegate.cs
- TrackBar.cs
- DataObject.cs
- FixedPageProcessor.cs
- MergeLocalizationDirectives.cs
- ComplexType.cs
- WebCategoryAttribute.cs
- TraceUtils.cs
- MethodBody.cs
- MetadataUtilsSmi.cs
- ObjectDataSourceDisposingEventArgs.cs
- ProjectionCamera.cs
- DataBindEngine.cs
- NamedPipeConnectionPool.cs
- WebPartManager.cs
- StylusButtonEventArgs.cs
- TraceHandler.cs
- Overlapped.cs
- TypographyProperties.cs
- initElementDictionary.cs
- webeventbuffer.cs
- SelfIssuedTokenFactoryCredential.cs
- _ConnectStream.cs
- CodeBlockBuilder.cs
- OracleRowUpdatingEventArgs.cs
- DiscoveryClientOutputChannel.cs
- BCryptSafeHandles.cs
- Pair.cs
- ClientSettingsProvider.cs
- DbParameterHelper.cs
- ConvertEvent.cs
- HtmlAnchor.cs
- AssemblyName.cs
- LazyTextWriterCreator.cs
- Baml2006SchemaContext.cs
- IndexingContentUnit.cs
- PrivacyNoticeElement.cs
- MetadataLocation.cs
- Membership.cs
- StateChangeEvent.cs
- EventLogPermissionAttribute.cs
- Convert.cs
- DbProviderFactoriesConfigurationHandler.cs
- ServiceCredentialsElement.cs
- DecoderNLS.cs
- DetailsViewActionList.cs
- LeftCellWrapper.cs
- SqlUserDefinedAggregateAttribute.cs
- SmtpNegotiateAuthenticationModule.cs
- TypeSchema.cs
- CodeThrowExceptionStatement.cs
- DataServiceHostFactory.cs
- CodeComment.cs
- ClickablePoint.cs
- UriTemplateTableMatchCandidate.cs
- RoleExceptions.cs
- TransactionTable.cs
- XmlTypeAttribute.cs
- LambdaCompiler.Binary.cs
- XmlSchemaDocumentation.cs
- BindingsCollection.cs
- PageBuildProvider.cs
- ScrollProperties.cs