Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Media / Animation / ControllableStoryboardAction.cs / 1 / ControllableStoryboardAction.cs
/****************************************************************************\ * * File: ControllableStoryboardAction.cs * * This object includes a named Storyboard references. When triggered, the * name is resolved and passed to a derived class method to perform the * actual action. * * Copyright (C) by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System.ComponentModel; // DefaultValueAttribute using System.Diagnostics; // Debug.Assert using System.Windows.Documents; // TableTemplate using System.Windows.Markup; // INameScope namespace System.Windows.Media.Animation { ////// A controllable storyboard action associates a trigger action with a /// Storyboard. The association from this object is a string that is the name /// of the Storyboard in a resource dictionary. /// public abstract class ControllableStoryboardAction : TriggerAction { ////// Internal constructor - nobody is supposed to ever create an instance /// of this class. Use a derived class instead. /// internal ControllableStoryboardAction() { } ////// Name to use for resolving the storyboard reference needed. This /// points to a BeginStoryboard instance, and we're controlling that one. /// [DefaultValue(null)] public string BeginStoryboardName { get { return _beginStoryboardName; } set { if (IsSealed) { throw new InvalidOperationException(SR.Get(SRID.CannotChangeAfterSealed, "ControllableStoryboardAction")); } // Null is allowed to wipe out existing name - as long as another // valid name is set before Invoke time. _beginStoryboardName = value; } } internal sealed override void Invoke( FrameworkElement fe, FrameworkContentElement fce, Style targetStyle, FrameworkTemplate frameworkTemplate, Int64 layer ) { Debug.Assert( fe != null || fce != null, "Caller of internal function failed to verify that we have a FE or FCE - we have neither." ); Debug.Assert( targetStyle != null || frameworkTemplate != null, "This function expects to be called when the associated action is inside a Style/Template. But it was not given a reference to anything." ); INameScope nameScope = null; if( targetStyle != null ) { nameScope = targetStyle; } else { Debug.Assert( frameworkTemplate != null ); nameScope = frameworkTemplate; } Invoke( fe, fce, GetStoryboard( fe, fce, nameScope ) ); } internal sealed override void Invoke( FrameworkElement fe ) { Debug.Assert( fe != null, "Invoke needs an object as starting point"); Invoke( fe, null, GetStoryboard( fe, null, null ) ); } internal virtual void Invoke( FrameworkElement containingFE, FrameworkContentElement containingFCE, Storyboard storyboard ) { } // Find a Storyboard object for this StoryboardAction to act on, using the // given BeginStoryboardName to find a BeginStoryboard instance and use // its Storyboard object reference. private Storyboard GetStoryboard( FrameworkElement fe, FrameworkContentElement fce, INameScope nameScope ) { if( BeginStoryboardName == null ) { throw new InvalidOperationException(SR.Get(SRID.Storyboard_BeginStoryboardNameRequired)); } BeginStoryboard keyedBeginStoryboard = Storyboard.ResolveBeginStoryboardName( BeginStoryboardName, nameScope, fe, fce ); Storyboard storyboard = keyedBeginStoryboard.Storyboard; if( storyboard == null ) { throw new InvalidOperationException(SR.Get(SRID.Storyboard_BeginStoryboardNoStoryboard, BeginStoryboardName)); } return storyboard; } private string _beginStoryboardName = null; } } // 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
- Drawing.cs
- SafeTimerHandle.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- PathFigureCollectionConverter.cs
- RSAPKCS1KeyExchangeFormatter.cs
- TransactionFlowBindingElementImporter.cs
- DataKeyArray.cs
- _TLSstream.cs
- Line.cs
- FusionWrap.cs
- EmptyEnumerator.cs
- Attribute.cs
- _Semaphore.cs
- Rotation3DAnimationBase.cs
- DoubleAnimationBase.cs
- PagesSection.cs
- UnsafeNativeMethods.cs
- Baml2006SchemaContext.cs
- DesignerActionItemCollection.cs
- LinearGradientBrush.cs
- TextTreeNode.cs
- FontUnit.cs
- ActivityExecutionFilter.cs
- Int16AnimationUsingKeyFrames.cs
- SecureConversationServiceElement.cs
- ClientTargetSection.cs
- VarInfo.cs
- RemotingServices.cs
- ModuleConfigurationInfo.cs
- NestedContainer.cs
- WebResourceUtil.cs
- GridViewSelectEventArgs.cs
- IdentitySection.cs
- Decorator.cs
- ScriptingJsonSerializationSection.cs
- CaseInsensitiveComparer.cs
- ClassGenerator.cs
- MembershipPasswordException.cs
- Style.cs
- AutoResizedEvent.cs
- ILGenerator.cs
- NotifyCollectionChangedEventArgs.cs
- PopupRoot.cs
- XsdBuildProvider.cs
- TreeNodeMouseHoverEvent.cs
- ParameterBuilder.cs
- ConfigPathUtility.cs
- SoapExtensionImporter.cs
- HwndHostAutomationPeer.cs
- Rotation3D.cs
- AlternateView.cs
- Stream.cs
- ProviderSettings.cs
- NativeMethods.cs
- Model3D.cs
- MeshGeometry3D.cs
- SiteMapHierarchicalDataSourceView.cs
- Lazy.cs
- SqlNode.cs
- RootBuilder.cs
- GridViewColumnHeaderAutomationPeer.cs
- DesignerTextViewAdapter.cs
- RemotingConfiguration.cs
- RouteParametersHelper.cs
- EditorBrowsableAttribute.cs
- XmlTextReaderImplHelpers.cs
- SolidBrush.cs
- SelectionBorderGlyph.cs
- DataGridViewCellLinkedList.cs
- InputElement.cs
- RefreshPropertiesAttribute.cs
- TableLayoutColumnStyleCollection.cs
- InstanceNormalEvent.cs
- CodeMemberField.cs
- CompilationSection.cs
- Vector3DAnimation.cs
- DataObjectFieldAttribute.cs
- ValidationErrorEventArgs.cs
- TextServicesLoader.cs
- Rfc4050KeyFormatter.cs
- DigitShape.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- EntityClientCacheKey.cs
- ControlDesignerState.cs
- HandlerFactoryCache.cs
- OdbcConnectionHandle.cs
- WindowsToolbar.cs
- Currency.cs
- SafeJobHandle.cs
- ElapsedEventArgs.cs
- AnnotationResource.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- DurationConverter.cs
- XmlUtilWriter.cs
- DataGridViewMethods.cs
- HandleExceptionArgs.cs
- DataGridViewComboBoxEditingControl.cs
- DesignSurfaceCollection.cs
- TextLine.cs
- WebPartPersonalization.cs