Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Automation / Peers / ButtonBaseAutomationPeer.cs / 1 / ButtonBaseAutomationPeer.cs
using System;
using System.Collections;
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.Input;
using System.Windows.Interop;
using System.Windows.Media;
using MS.Internal;
using MS.Win32;
namespace System.Windows.Automation.Peers
{
///
public abstract class ButtonBaseAutomationPeer: FrameworkElementAutomationPeer
{
///
protected ButtonBaseAutomationPeer(ButtonBase owner): base(owner)
{}
///
override protected string GetAcceleratorKeyCore()
{
string acceleratorKey = base.GetAcceleratorKeyCore();
if (acceleratorKey == string.Empty)
{
RoutedUICommand uiCommand = ((ButtonBase)Owner).Command as RoutedUICommand;
if (uiCommand != null && !string.IsNullOrEmpty(uiCommand.Text))
{
acceleratorKey = uiCommand.Text;
}
}
return acceleratorKey;
}
///
protected override string GetAutomationIdCore()
{
string result = base.GetAutomationIdCore();
if (string.IsNullOrEmpty(result))
{
ButtonBase owner = (ButtonBase)Owner;
RoutedCommand command = owner.Command as RoutedCommand;
if (command != null)
{
string commandName = command.Name;
if (!string.IsNullOrEmpty(commandName))
{
result = commandName;
}
}
}
return result ?? string.Empty;
}
// Return the base without the AccessKey character
///
override protected string GetNameCore()
{
string result = base.GetNameCore();
ButtonBase bb = (ButtonBase)Owner;
if (!string.IsNullOrEmpty(result))
{
if (bb.Content is string)
{
result = AccessText.RemoveAccessKeyMarker(result);
}
}
else
{
RoutedUICommand uiCommand = bb.Command as RoutedUICommand;
if (uiCommand != null && !string.IsNullOrEmpty(uiCommand.Text))
{
result = uiCommand.Text;
}
}
return result;
}
}
}
// 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
- DiscoveryReference.cs
- CollectionView.cs
- DesignerActionKeyboardBehavior.cs
- ScaleTransform.cs
- ConfigXmlComment.cs
- RangeValueProviderWrapper.cs
- WsatConfiguration.cs
- StateMachineExecutionState.cs
- ImageListUtils.cs
- HtmlInputRadioButton.cs
- FrameworkElement.cs
- KeyInfo.cs
- CompositeDataBoundControl.cs
- PowerEase.cs
- _ConnectOverlappedAsyncResult.cs
- EntityContainerEmitter.cs
- ParseElementCollection.cs
- milexports.cs
- Partitioner.cs
- SystemThemeKey.cs
- FragmentQueryKB.cs
- CryptoKeySecurity.cs
- Material.cs
- PreservationFileWriter.cs
- MsmqProcessProtocolHandler.cs
- StrokeDescriptor.cs
- Scene3D.cs
- ExpressionUtilities.cs
- StringSource.cs
- FormViewCommandEventArgs.cs
- HttpWebResponse.cs
- PartitionResolver.cs
- EntityClientCacheEntry.cs
- DataControlField.cs
- SqlSelectClauseBuilder.cs
- MethodCallConverter.cs
- MultiBindingExpression.cs
- DataGridCommandEventArgs.cs
- WebPartTransformerAttribute.cs
- ProviderSettings.cs
- ThreadExceptionEvent.cs
- HasCopySemanticsAttribute.cs
- SqlCharStream.cs
- PolicyUnit.cs
- AsmxEndpointPickerExtension.cs
- StickyNote.cs
- SortKey.cs
- StretchValidation.cs
- XmlnsDictionary.cs
- StreamAsIStream.cs
- ControlCollection.cs
- SqlClientMetaDataCollectionNames.cs
- TextRangeEdit.cs
- _TransmitFileOverlappedAsyncResult.cs
- BamlTreeUpdater.cs
- XmlComplianceUtil.cs
- ZipIOLocalFileDataDescriptor.cs
- _NetworkingPerfCounters.cs
- RuleRef.cs
- TextBreakpoint.cs
- PhonemeConverter.cs
- TableSectionStyle.cs
- ExpressionBindings.cs
- RadioButton.cs
- X509WindowsSecurityToken.cs
- MsdtcClusterUtils.cs
- DataTemplateKey.cs
- EventLogPermissionAttribute.cs
- CompoundFileIOPermission.cs
- ProfileSettings.cs
- SvcMapFile.cs
- DockProviderWrapper.cs
- DataControlImageButton.cs
- StylusDevice.cs
- Monitor.cs
- PolicyStatement.cs
- HWStack.cs
- HtmlEncodedRawTextWriter.cs
- TemplateControlCodeDomTreeGenerator.cs
- TextAutomationPeer.cs
- BrushConverter.cs
- ApplicationBuildProvider.cs
- Oci.cs
- DataGridCellsPresenter.cs
- DispatcherExceptionEventArgs.cs
- CollectionChangeEventArgs.cs
- FileClassifier.cs
- WebPartDisplayModeEventArgs.cs
- DataGridViewTopRowAccessibleObject.cs
- RepeatButton.cs
- DummyDataSource.cs
- DesignRelation.cs
- ButtonColumn.cs
- IPAddress.cs
- XmlUtilWriter.cs
- _BaseOverlappedAsyncResult.cs
- DES.cs
- ProviderCollection.cs
- ExtensibleSyndicationObject.cs
- TableSectionStyle.cs