Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / MouseOverProperty.cs / 1 / MouseOverProperty.cs
using System;
using MS.Internal.KnownBoxes;
using System.Windows.Input;
namespace System.Windows
{
/////////////////////////////////////////////////////////////////////////
internal class MouseOverProperty : ReverseInheritProperty
{
/////////////////////////////////////////////////////////////////////
internal MouseOverProperty() : base(
UIElement.IsMouseOverPropertyKey,
CoreFlags.IsMouseOverCache,
CoreFlags.IsMouseOverChanged)
{
}
/////////////////////////////////////////////////////////////////////
internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
{
// Before we fire the mouse event we need to figure if the notification is still relevant.
// This is because it is possible that the mouse state has changed during the previous
// property engine callout. Example: Consider a MessageBox being displayed during the
// IsMouseOver OnPropertyChanged override.
bool shouldFireNotification = false;
if (uie != null)
{
shouldFireNotification = (!oldValue && uie.IsMouseOver) || (oldValue && !uie.IsMouseOver);
}
else if (ce != null)
{
shouldFireNotification = (!oldValue && ce.IsMouseOver) || (oldValue && !ce.IsMouseOver);
}
else if (uie3D != null)
{
shouldFireNotification = (!oldValue && uie3D.IsMouseOver) || (oldValue && !uie3D.IsMouseOver);
}
if (shouldFireNotification)
{
MouseEventArgs mouseEventArgs = new MouseEventArgs(Mouse.PrimaryDevice, Environment.TickCount, Mouse.PrimaryDevice.StylusDevice);
mouseEventArgs.RoutedEvent = oldValue ? Mouse.MouseLeaveEvent : Mouse.MouseEnterEvent;
if (uie != null)
{
uie.RaiseEvent(mouseEventArgs);
}
else if (ce != null)
{
ce.RaiseEvent(mouseEventArgs);
}
else if (uie3D != null)
{
uie3D.RaiseEvent(mouseEventArgs);
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using MS.Internal.KnownBoxes;
using System.Windows.Input;
namespace System.Windows
{
/////////////////////////////////////////////////////////////////////////
internal class MouseOverProperty : ReverseInheritProperty
{
/////////////////////////////////////////////////////////////////////
internal MouseOverProperty() : base(
UIElement.IsMouseOverPropertyKey,
CoreFlags.IsMouseOverCache,
CoreFlags.IsMouseOverChanged)
{
}
/////////////////////////////////////////////////////////////////////
internal override void FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, bool oldValue)
{
// Before we fire the mouse event we need to figure if the notification is still relevant.
// This is because it is possible that the mouse state has changed during the previous
// property engine callout. Example: Consider a MessageBox being displayed during the
// IsMouseOver OnPropertyChanged override.
bool shouldFireNotification = false;
if (uie != null)
{
shouldFireNotification = (!oldValue && uie.IsMouseOver) || (oldValue && !uie.IsMouseOver);
}
else if (ce != null)
{
shouldFireNotification = (!oldValue && ce.IsMouseOver) || (oldValue && !ce.IsMouseOver);
}
else if (uie3D != null)
{
shouldFireNotification = (!oldValue && uie3D.IsMouseOver) || (oldValue && !uie3D.IsMouseOver);
}
if (shouldFireNotification)
{
MouseEventArgs mouseEventArgs = new MouseEventArgs(Mouse.PrimaryDevice, Environment.TickCount, Mouse.PrimaryDevice.StylusDevice);
mouseEventArgs.RoutedEvent = oldValue ? Mouse.MouseLeaveEvent : Mouse.MouseEnterEvent;
if (uie != null)
{
uie.RaiseEvent(mouseEventArgs);
}
else if (ce != null)
{
ce.RaiseEvent(mouseEventArgs);
}
else if (uie3D != null)
{
uie3D.RaiseEvent(mouseEventArgs);
}
}
}
}
}
// 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
- SelectedDatesCollection.cs
- DesignerEventService.cs
- Vector3D.cs
- APCustomTypeDescriptor.cs
- EventLogEntry.cs
- RandomNumberGenerator.cs
- mda.cs
- SqlDataSourceView.cs
- WindowsGraphics.cs
- StylusPointPropertyId.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- SystemKeyConverter.cs
- InfoCardProofToken.cs
- SelectionRange.cs
- SchemaAttDef.cs
- TagMapInfo.cs
- ComponentEditorPage.cs
- BooleanAnimationUsingKeyFrames.cs
- IItemContainerGenerator.cs
- DebugHandleTracker.cs
- OperationPickerDialog.designer.cs
- SettingsAttributeDictionary.cs
- HostProtectionException.cs
- WindowsBrush.cs
- ContentType.cs
- QilInvoke.cs
- DPAPIProtectedConfigurationProvider.cs
- LiteralText.cs
- XmlAnyElementAttribute.cs
- SerializableTypeCodeDomSerializer.cs
- Int64Converter.cs
- ComponentEvent.cs
- MenuItemBindingCollection.cs
- DataRow.cs
- ComponentEvent.cs
- InputProcessorProfiles.cs
- FactoryRecord.cs
- XmlHierarchyData.cs
- TcpStreams.cs
- ProgramPublisher.cs
- DataServiceRequest.cs
- MembershipUser.cs
- counter.cs
- CompensationExtension.cs
- RestClientProxyHandler.cs
- TreeViewImageIndexConverter.cs
- TlsSspiNegotiation.cs
- DesignerVerb.cs
- OdbcDataAdapter.cs
- RootBuilder.cs
- RedirectionProxy.cs
- RegexWriter.cs
- FileSystemEventArgs.cs
- Item.cs
- SqlOuterApplyReducer.cs
- VSDExceptions.cs
- ByteStreamMessageUtility.cs
- SetMemberBinder.cs
- CompiledQuery.cs
- ValueOfAction.cs
- TransformerInfo.cs
- BaseHashHelper.cs
- ResourceDescriptionAttribute.cs
- Collection.cs
- NameValueConfigurationCollection.cs
- FileSystemWatcher.cs
- XsltSettings.cs
- UnsafeNativeMethods.cs
- UIntPtr.cs
- DataGridCell.cs
- DeclarativeCatalogPartDesigner.cs
- RelatedImageListAttribute.cs
- RawStylusInput.cs
- BuilderInfo.cs
- DbDataSourceEnumerator.cs
- DeferrableContentConverter.cs
- MemberDomainMap.cs
- TextEmbeddedObject.cs
- UnwrappedTypesXmlSerializerManager.cs
- NetworkInterface.cs
- StreamInfo.cs
- ToolStripTextBox.cs
- PropertyRef.cs
- ListenerElementsCollection.cs
- DataSourceCacheDurationConverter.cs
- MatrixTransform3D.cs
- NameSpaceEvent.cs
- RIPEMD160.cs
- IncrementalHitTester.cs
- RegexCompilationInfo.cs
- Debug.cs
- WebPartConnectionsEventArgs.cs
- LineSegment.cs
- BCryptNative.cs
- Popup.cs
- TemplateInstanceAttribute.cs
- Formatter.cs
- basecomparevalidator.cs
- CommandTreeTypeHelper.cs
- Selection.cs