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
- XXXInfos.cs
- compensatingcollection.cs
- DetailsView.cs
- ConfigurationException.cs
- XmlSchemaExporter.cs
- LocationSectionRecord.cs
- ContainerControlDesigner.cs
- QueryLifecycle.cs
- Expression.DebuggerProxy.cs
- Run.cs
- LockCookie.cs
- SafeArrayRankMismatchException.cs
- CommentGlyph.cs
- VisualStyleRenderer.cs
- VariantWrapper.cs
- ArglessEventHandlerProxy.cs
- SQLInt64.cs
- ToolStripSplitStackLayout.cs
- DrawingGroupDrawingContext.cs
- RankException.cs
- UnionCqlBlock.cs
- CreateUserErrorEventArgs.cs
- ContentFileHelper.cs
- XmlBinaryReaderSession.cs
- ColumnWidthChangingEvent.cs
- DataGridTextBoxColumn.cs
- TabControl.cs
- EntityDataSourceDesignerHelper.cs
- ConstructorBuilder.cs
- ContextMenuAutomationPeer.cs
- __Filters.cs
- UnknownWrapper.cs
- UnknownWrapper.cs
- XmlNotation.cs
- Formatter.cs
- FormatterServices.cs
- EventListener.cs
- VisualTarget.cs
- TextControlDesigner.cs
- ColorTransformHelper.cs
- FontFamilyValueSerializer.cs
- InstanceLockedException.cs
- DropShadowBitmapEffect.cs
- URIFormatException.cs
- TimeSpanConverter.cs
- XPathCompileException.cs
- ContainerAction.cs
- Enlistment.cs
- DataGridViewRow.cs
- StyleTypedPropertyAttribute.cs
- EncoderBestFitFallback.cs
- PageStatePersister.cs
- StringUtil.cs
- Stack.cs
- CharAnimationUsingKeyFrames.cs
- FormatStringEditor.cs
- SqlReorderer.cs
- WebPartConnectionsConnectVerb.cs
- TextFormatter.cs
- FileSystemWatcher.cs
- Cursor.cs
- ToolStripSeparator.cs
- TreeViewImageGenerator.cs
- SchemaMapping.cs
- OverrideMode.cs
- XmlTextReaderImpl.cs
- _ProxyRegBlob.cs
- HttpCookieCollection.cs
- Page.cs
- ImageField.cs
- XmlnsDefinitionAttribute.cs
- Hyperlink.cs
- AutomationPatternInfo.cs
- ChangeBlockUndoRecord.cs
- CultureInfo.cs
- DeviceContext.cs
- WindowsSolidBrush.cs
- CssClassPropertyAttribute.cs
- EntityDataSource.cs
- HttpAsyncResult.cs
- CustomWebEventKey.cs
- XmlSerializerNamespaces.cs
- DataGridTextBox.cs
- DeferredElementTreeState.cs
- CheckBoxFlatAdapter.cs
- ExclusiveNamedPipeTransportManager.cs
- XmlCodeExporter.cs
- ConstantExpression.cs
- FileDialog.cs
- DbParameterCollectionHelper.cs
- TempEnvironment.cs
- TypeSource.cs
- documentsequencetextpointer.cs
- EncodingInfo.cs
- AccessorTable.cs
- Roles.cs
- GridErrorDlg.cs
- ServerValidateEventArgs.cs
- SqlAliaser.cs
- PageContent.cs