Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Automation / Peers / ListBoxItemAutomationPeer.cs / 1305600 / ListBoxItemAutomationPeer.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.Interop;
using System.Windows.Media;
using MS.Internal;
using MS.Win32;
namespace System.Windows.Automation.Peers
{
///
public class ListBoxItemAutomationPeer : SelectorItemAutomationPeer, IScrollItemProvider
{
///
public ListBoxItemAutomationPeer(object owner, SelectorAutomationPeer selectorAutomationPeer)
: base(owner, selectorAutomationPeer)
{
}
///
override protected string GetClassNameCore()
{
return "ListBoxItem";
}
///
override protected AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.ListItem;
}
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.ScrollItem)
{
return this;
}
return base.GetPattern(patternInterface);
}
///For ComboBoxItem for which peer is this element only, scrolling should happen when the pop-up is expanded.
internal override void RealizeCore()
{
ComboBox parent = ItemsControlAutomationPeer.Owner as ComboBox;
if (parent != null)
{
IExpandCollapseProvider iecp = (IExpandCollapseProvider)UIElementAutomationPeer.FromElement(parent) as ComboBoxAutomationPeer;
if (iecp.ExpandCollapseState != ExpandCollapseState.Expanded)
iecp.Expand();
}
base.RealizeCore();
}
void IScrollItemProvider.ScrollIntoView()
{
ListBox parent = ItemsControlAutomationPeer.Owner as ListBox;
if (parent != null)
parent.ScrollIntoView(Item);
else
{
ComboBoxAutomationPeer parentPeer = ItemsControlAutomationPeer as ComboBoxAutomationPeer;
if(parentPeer != null)
parentPeer.ScrollItemIntoView(Item);
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
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.Interop;
using System.Windows.Media;
using MS.Internal;
using MS.Win32;
namespace System.Windows.Automation.Peers
{
///
public class ListBoxItemAutomationPeer : SelectorItemAutomationPeer, IScrollItemProvider
{
///
public ListBoxItemAutomationPeer(object owner, SelectorAutomationPeer selectorAutomationPeer)
: base(owner, selectorAutomationPeer)
{
}
///
override protected string GetClassNameCore()
{
return "ListBoxItem";
}
///
override protected AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.ListItem;
}
///
override public object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.ScrollItem)
{
return this;
}
return base.GetPattern(patternInterface);
}
///For ComboBoxItem for which peer is this element only, scrolling should happen when the pop-up is expanded.
internal override void RealizeCore()
{
ComboBox parent = ItemsControlAutomationPeer.Owner as ComboBox;
if (parent != null)
{
IExpandCollapseProvider iecp = (IExpandCollapseProvider)UIElementAutomationPeer.FromElement(parent) as ComboBoxAutomationPeer;
if (iecp.ExpandCollapseState != ExpandCollapseState.Expanded)
iecp.Expand();
}
base.RealizeCore();
}
void IScrollItemProvider.ScrollIntoView()
{
ListBox parent = ItemsControlAutomationPeer.Owner as ListBox;
if (parent != null)
parent.ScrollIntoView(Item);
else
{
ComboBoxAutomationPeer parentPeer = ItemsControlAutomationPeer as ComboBoxAutomationPeer;
if(parentPeer != null)
parentPeer.ScrollItemIntoView(Item);
}
}
}
}
// 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
- HeaderedItemsControl.cs
- PersistenceIOParticipant.cs
- SchemaElementLookUpTable.cs
- FileEnumerator.cs
- GenericIdentity.cs
- SecurityTokenSpecification.cs
- RegistrySecurity.cs
- TextRangeEditTables.cs
- ByteStorage.cs
- Vector3D.cs
- _OverlappedAsyncResult.cs
- Util.cs
- AppDomainFactory.cs
- NameValuePair.cs
- UnitControl.cs
- Int32RectValueSerializer.cs
- AssemblyBuilder.cs
- ReferencedCategoriesDocument.cs
- XmlSecureResolver.cs
- FileEnumerator.cs
- ReplyChannel.cs
- SiteMap.cs
- SortKey.cs
- WebPartConnectionsCancelEventArgs.cs
- StringWriter.cs
- QuadraticBezierSegment.cs
- ArgumentException.cs
- AncillaryOps.cs
- _CommandStream.cs
- StaticFileHandler.cs
- TreeNodeEventArgs.cs
- CodeRegionDirective.cs
- CollectionCodeDomSerializer.cs
- ConfigurationLockCollection.cs
- PropertyTabChangedEvent.cs
- ObjectHelper.cs
- StylusCaptureWithinProperty.cs
- FullTextBreakpoint.cs
- BinaryOperationBinder.cs
- PixelFormats.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- FindRequestContext.cs
- EventSinkActivityDesigner.cs
- ZipIOCentralDirectoryFileHeader.cs
- hwndwrapper.cs
- LoadWorkflowByInstanceKeyCommand.cs
- IsolationInterop.cs
- EventSourceCreationData.cs
- WebPartDisplayMode.cs
- PropVariant.cs
- TypeDescriptorFilterService.cs
- QueryStringParameter.cs
- ScriptReference.cs
- TitleStyle.cs
- WpfXamlMember.cs
- CodeNamespace.cs
- FileLevelControlBuilderAttribute.cs
- WithStatement.cs
- AncillaryOps.cs
- BindingBase.cs
- ClrProviderManifest.cs
- StreamWriter.cs
- OracleDataReader.cs
- ArithmeticException.cs
- ResXBuildProvider.cs
- ScriptMethodAttribute.cs
- X500Name.cs
- TextControl.cs
- ClientTargetSection.cs
- DesignerSerializationManager.cs
- CheckBoxRenderer.cs
- StorageSetMapping.cs
- TextRangeSerialization.cs
- UserPreferenceChangingEventArgs.cs
- ValueConversionAttribute.cs
- ListViewHitTestInfo.cs
- Italic.cs
- ProfileManager.cs
- Function.cs
- GeneralTransformGroup.cs
- RectangleGeometry.cs
- DiscoveryMessageSequence11.cs
- ObfuscateAssemblyAttribute.cs
- VolatileEnlistmentMultiplexing.cs
- SQLInt64Storage.cs
- _BaseOverlappedAsyncResult.cs
- ContextQuery.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- RelatedEnd.cs
- PngBitmapEncoder.cs
- LineProperties.cs
- ActivationProxy.cs
- SqlSupersetValidator.cs
- EntityDataSourceQueryBuilder.cs
- MD5.cs
- XmlnsPrefixAttribute.cs
- SapiRecoContext.cs
- ScriptManagerProxy.cs
- CryptoStream.cs
- SmtpAuthenticationManager.cs