Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / System / Windows / TriggerAction.cs / 1 / TriggerAction.cs
/****************************************************************************\
*
* File: TriggerAction.cs
*
* A TriggerAction is stored within a Trigger object as one of the actions to
* be performed by that trigger. A Trigger object is similar to an if/then
* statement, and by that analogy a TriggerActionCollection is the entire
* "then" block of the Trigger, and a TriggerAction is a single line within
* the "then" block.
*
* Copyright (C) by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using System;
using MS.Internal;
namespace System.Windows
{
///
/// A class that describes an action to perform for a trigger
///
public abstract class TriggerAction : DependencyObject
{
///
/// Internal constructor - nobody is supposed to ever create an instance
/// of this class. Use a derived class instead.
///
internal TriggerAction()
{
}
///
/// Called when all conditions have been satisfied for this action to be
/// invoked. (Conditions are not described on this TriggerAction object,
/// but on the Trigger object holding it.)
///
///
/// This variant is called when the Trigger lives in a Style, and
/// hence given a reference to its corresponding Style object.
///
internal abstract void Invoke( FrameworkElement fe,
FrameworkContentElement fce,
Style targetStyle,
FrameworkTemplate targetTemplate,
Int64 layer);
///
/// Called when all conditions have been satisfied for this action to be
/// invoked. (Conditions are not described on this TriggerAction object,
/// but on the Trigger object holding it.)
///
///
/// This variant is called when the Trigger lives on an element, as
/// opposed to Style, so it is given only the reference to the element.
///
internal abstract void Invoke( FrameworkElement fe );
///
/// The EventTrigger object that contains this action.
///
///
/// A TriggerAction may need to get back to the Trigger that
/// holds it, this is the back-link to allow that. Also, this allows
/// us to verify that each TriggerAction is associated with one and
/// only one Trigger.
///
internal TriggerBase ContainingTrigger
{
get
{
return _containingTrigger;
}
}
///
/// Seal this TriggerAction to prevent further updates
///
///
/// TriggerActionCollection will call this method to seal individual
/// TriggerAction objects. We do some check here then call the
/// parameter-less Seal() so subclasses can also do what they need to do.
///
internal void Seal( TriggerBase containingTrigger )
{
if( IsSealed && containingTrigger != _containingTrigger )
{
throw new InvalidOperationException(SR.Get(SRID.TriggerActionMustBelongToASingleTrigger));
}
_containingTrigger = containingTrigger;
Seal();
}
///
/// A derived class overrideing Seal() should set object state such
/// that further changes are not allowed. This is also a time to make
/// validation checks to see if all parameters make sense.
///
internal override void Seal()
{
if( IsSealed )
{
throw new InvalidOperationException(SR.Get(SRID.TriggerActionAlreadySealed));
}
base.Seal();
}
///
/// Checks sealed status and throws exception if object is sealed
///
internal void CheckSealed()
{
if( IsSealed )
{
throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "TriggerAction"));
}
}
// Define the DO's inheritance context
internal override DependencyObject InheritanceContext
{
get { return _inheritanceContext; }
}
// Receive a new inheritance context (this will be a FE/FCE)
internal override void AddInheritanceContext(DependencyObject context, DependencyProperty property)
{
InheritanceContextHelper.AddInheritanceContext(context,
this,
ref _hasMultipleInheritanceContexts,
ref _inheritanceContext);
}
// Remove an inheritance context (this will be a FE/FCE)
internal override void RemoveInheritanceContext(DependencyObject context, DependencyProperty property)
{
InheritanceContextHelper.RemoveInheritanceContext(context,
this,
ref _hasMultipleInheritanceContexts,
ref _inheritanceContext);
}
///
/// Says if the current instance has multiple InheritanceContexts
///
internal override bool HasMultipleInheritanceContexts
{
get { return _hasMultipleInheritanceContexts; }
}
private TriggerBase _containingTrigger = null;
// Fields to implement DO's inheritance context
private DependencyObject _inheritanceContext = null;
private bool _hasMultipleInheritanceContexts = false;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/****************************************************************************\
*
* File: TriggerAction.cs
*
* A TriggerAction is stored within a Trigger object as one of the actions to
* be performed by that trigger. A Trigger object is similar to an if/then
* statement, and by that analogy a TriggerActionCollection is the entire
* "then" block of the Trigger, and a TriggerAction is a single line within
* the "then" block.
*
* Copyright (C) by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using System;
using MS.Internal;
namespace System.Windows
{
///
/// A class that describes an action to perform for a trigger
///
public abstract class TriggerAction : DependencyObject
{
///
/// Internal constructor - nobody is supposed to ever create an instance
/// of this class. Use a derived class instead.
///
internal TriggerAction()
{
}
///
/// Called when all conditions have been satisfied for this action to be
/// invoked. (Conditions are not described on this TriggerAction object,
/// but on the Trigger object holding it.)
///
///
/// This variant is called when the Trigger lives in a Style, and
/// hence given a reference to its corresponding Style object.
///
internal abstract void Invoke( FrameworkElement fe,
FrameworkContentElement fce,
Style targetStyle,
FrameworkTemplate targetTemplate,
Int64 layer);
///
/// Called when all conditions have been satisfied for this action to be
/// invoked. (Conditions are not described on this TriggerAction object,
/// but on the Trigger object holding it.)
///
///
/// This variant is called when the Trigger lives on an element, as
/// opposed to Style, so it is given only the reference to the element.
///
internal abstract void Invoke( FrameworkElement fe );
///
/// The EventTrigger object that contains this action.
///
///
/// A TriggerAction may need to get back to the Trigger that
/// holds it, this is the back-link to allow that. Also, this allows
/// us to verify that each TriggerAction is associated with one and
/// only one Trigger.
///
internal TriggerBase ContainingTrigger
{
get
{
return _containingTrigger;
}
}
///
/// Seal this TriggerAction to prevent further updates
///
///
/// TriggerActionCollection will call this method to seal individual
/// TriggerAction objects. We do some check here then call the
/// parameter-less Seal() so subclasses can also do what they need to do.
///
internal void Seal( TriggerBase containingTrigger )
{
if( IsSealed && containingTrigger != _containingTrigger )
{
throw new InvalidOperationException(SR.Get(SRID.TriggerActionMustBelongToASingleTrigger));
}
_containingTrigger = containingTrigger;
Seal();
}
///
/// A derived class overrideing Seal() should set object state such
/// that further changes are not allowed. This is also a time to make
/// validation checks to see if all parameters make sense.
///
internal override void Seal()
{
if( IsSealed )
{
throw new InvalidOperationException(SR.Get(SRID.TriggerActionAlreadySealed));
}
base.Seal();
}
///
/// Checks sealed status and throws exception if object is sealed
///
internal void CheckSealed()
{
if( IsSealed )
{
throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "TriggerAction"));
}
}
// Define the DO's inheritance context
internal override DependencyObject InheritanceContext
{
get { return _inheritanceContext; }
}
// Receive a new inheritance context (this will be a FE/FCE)
internal override void AddInheritanceContext(DependencyObject context, DependencyProperty property)
{
InheritanceContextHelper.AddInheritanceContext(context,
this,
ref _hasMultipleInheritanceContexts,
ref _inheritanceContext);
}
// Remove an inheritance context (this will be a FE/FCE)
internal override void RemoveInheritanceContext(DependencyObject context, DependencyProperty property)
{
InheritanceContextHelper.RemoveInheritanceContext(context,
this,
ref _hasMultipleInheritanceContexts,
ref _inheritanceContext);
}
///
/// Says if the current instance has multiple InheritanceContexts
///
internal override bool HasMultipleInheritanceContexts
{
get { return _hasMultipleInheritanceContexts; }
}
private TriggerBase _containingTrigger = null;
// Fields to implement DO's inheritance context
private DependencyObject _inheritanceContext = null;
private bool _hasMultipleInheritanceContexts = false;
}
}
// 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
- SubpageParagraph.cs
- TemplateXamlTreeBuilder.cs
- ClientBuildManagerCallback.cs
- QilValidationVisitor.cs
- DataPagerFieldCommandEventArgs.cs
- TreeNodeBindingDepthConverter.cs
- Stroke2.cs
- EasingFunctionBase.cs
- WsdlImporterElement.cs
- Permission.cs
- XdrBuilder.cs
- DependencyPropertyKind.cs
- SamlAttributeStatement.cs
- DataDesignUtil.cs
- X509WindowsSecurityToken.cs
- UnmanagedMarshal.cs
- EntityDataSourceSelectedEventArgs.cs
- CompilerState.cs
- TextEffectCollection.cs
- _CommandStream.cs
- GroupLabel.cs
- WsdlBuildProvider.cs
- ToolStripStatusLabel.cs
- CollectionChange.cs
- DataGridToolTip.cs
- DateTimeFormatInfo.cs
- ArgumentOutOfRangeException.cs
- ApplyTemplatesAction.cs
- ParentQuery.cs
- AssemblyCache.cs
- ImageSource.cs
- DataRowChangeEvent.cs
- MatrixAnimationUsingKeyFrames.cs
- WebConfigurationFileMap.cs
- XmlBoundElement.cs
- QueryableDataSourceHelper.cs
- AutoGeneratedFieldProperties.cs
- Binding.cs
- FlowDocumentReader.cs
- DependencyPropertyValueSerializer.cs
- MarkupExtensionReturnTypeAttribute.cs
- DbProviderConfigurationHandler.cs
- ExpressionConverter.cs
- BookmarkEventArgs.cs
- PingOptions.cs
- TextBlock.cs
- AssociationSetEnd.cs
- EndpointPerformanceCounters.cs
- MetadataArtifactLoader.cs
- SmiMetaDataProperty.cs
- TimelineGroup.cs
- WebPartTransformer.cs
- StaticFileHandler.cs
- InvokeMethod.cs
- Mouse.cs
- OperatorExpressions.cs
- ExceptionUtil.cs
- PeerNameResolver.cs
- FrameworkReadOnlyPropertyMetadata.cs
- CookielessHelper.cs
- WmfPlaceableFileHeader.cs
- KeyPressEvent.cs
- IxmlLineInfo.cs
- figurelength.cs
- ISFTagAndGuidCache.cs
- SQLByteStorage.cs
- httpserverutility.cs
- Pair.cs
- OfTypeExpression.cs
- ThicknessAnimation.cs
- SslStream.cs
- newinstructionaction.cs
- WebControlParameterProxy.cs
- XmlUrlResolver.cs
- ParserExtension.cs
- WpfXamlLoader.cs
- WindowsScrollBar.cs
- HostingEnvironmentWrapper.cs
- ConvertTextFrag.cs
- DuplicateWaitObjectException.cs
- ColorEditor.cs
- LocalizationComments.cs
- EntityDataSourceDataSelection.cs
- GZipDecoder.cs
- Wizard.cs
- InputLanguageProfileNotifySink.cs
- WasHttpModulesInstallComponent.cs
- DbProviderFactories.cs
- ParameterRetriever.cs
- SqlExpander.cs
- WeakReferenceList.cs
- CommonObjectSecurity.cs
- SiteMapDataSourceView.cs
- FtpWebResponse.cs
- PrintDocument.cs
- OrderToken.cs
- SlotInfo.cs
- Int16AnimationBase.cs
- DataGridSortCommandEventArgs.cs
- CompiledQuery.cs