Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / EventSetter.cs / 1 / EventSetter.cs
/****************************************************************************\ * * File: SetterBase.cs * * TargetType event setting class. * * Copyright (C) 2004 by Microsoft Corporation. All rights reserved. * \***************************************************************************/ using System; using System.ComponentModel; // EditorBrowsableAttribute namespace System.Windows { ////// TargetType event setting class. /// public class EventSetter : SetterBase { ////// EventSetter construction /// public EventSetter() { } ////// EventSetter construction /// public EventSetter(RoutedEvent routedEvent, Delegate handler) { if (routedEvent == null) { throw new ArgumentNullException("routedEvent"); } if (handler == null) { throw new ArgumentNullException("handler"); } _event = routedEvent; _handler = handler; } ////// Event that is being set by this setter /// public RoutedEvent Event { get { return _event; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckSealed(); _event = value; } } ////// Handler delegate that is being set by this setter /// public Delegate Handler { get { return _handler; } set { if (value == null) { throw new ArgumentNullException("value"); } CheckSealed(); _handler = value; } } ////// HandledEventsToo flag that is being set by this setter /// [EditorBrowsable(EditorBrowsableState.Never)] public bool HandledEventsToo { get { return _handledEventsToo; } set { CheckSealed(); _handledEventsToo = value; } } // // Do the error checking that we can only do once all of the properties have been // set, then call up to base. // internal override void Seal() { if (_event == null) { throw new ArgumentException(SR.Get(SRID.NullPropertyIllegal, "EventSetter.Event")); } if (_handler == null) { throw new ArgumentException(SR.Get(SRID.NullPropertyIllegal, "EventSetter.Handler")); } if (_handler.GetType() != _event.HandlerType) { throw new ArgumentException(SR.Get(SRID.HandlerTypeIllegal)); } base.Seal(); } private RoutedEvent _event; private Delegate _handler; private bool _handledEventsToo; } } // 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
- CapabilitiesPattern.cs
- dataobject.cs
- SourceChangedEventArgs.cs
- NumericUpDown.cs
- ToolStripSplitStackLayout.cs
- EventLogPermissionEntry.cs
- CatalogPart.cs
- Listbox.cs
- NativeMethods.cs
- Models.cs
- NavigationWindow.cs
- LineBreak.cs
- ParameterCollection.cs
- WindowsRichEditRange.cs
- RawStylusInputReport.cs
- XPathNodeIterator.cs
- HttpEncoder.cs
- TimeIntervalCollection.cs
- CryptoConfig.cs
- XPathNodePointer.cs
- DetailsViewDesigner.cs
- XmlSchemaSequence.cs
- CodeTryCatchFinallyStatement.cs
- TextDecorationCollection.cs
- User.cs
- Message.cs
- HttpPostedFileWrapper.cs
- safemediahandle.cs
- DtdParser.cs
- RowType.cs
- GridEntryCollection.cs
- ScriptControlManager.cs
- AutomationIdentifierGuids.cs
- SafeProcessHandle.cs
- DataGridViewEditingControlShowingEventArgs.cs
- ArrayItemReference.cs
- HierarchicalDataBoundControl.cs
- SchemaElementDecl.cs
- WebControl.cs
- CroppedBitmap.cs
- TextControlDesigner.cs
- SocketInformation.cs
- DataServiceExpressionVisitor.cs
- DesignerValidationSummaryAdapter.cs
- TogglePattern.cs
- GeometryModel3D.cs
- SiteMapPath.cs
- TreeNodeSelectionProcessor.cs
- x509store.cs
- ZipIOBlockManager.cs
- BoundingRectTracker.cs
- SyntaxCheck.cs
- ReadOnlyDataSourceView.cs
- HopperCache.cs
- unsafeIndexingFilterStream.cs
- SkinIDTypeConverter.cs
- Margins.cs
- FileDialogCustomPlaces.cs
- TableAdapterManagerHelper.cs
- MonthChangedEventArgs.cs
- SqlBooleanizer.cs
- WindowsSolidBrush.cs
- PrimitiveSchema.cs
- indexingfiltermarshaler.cs
- NativeMethodsOther.cs
- AuthorizationRuleCollection.cs
- BrowserDefinition.cs
- MemberInfoSerializationHolder.cs
- GlobalProxySelection.cs
- CngAlgorithmGroup.cs
- HostProtectionException.cs
- SecurityProtocol.cs
- FolderBrowserDialog.cs
- FixedPageAutomationPeer.cs
- SrgsRuleRef.cs
- DetailsViewCommandEventArgs.cs
- RelationshipConstraintValidator.cs
- DesignerHost.cs
- DataGridViewCellValidatingEventArgs.cs
- DrawingGroup.cs
- StreamInfo.cs
- HttpApplicationStateWrapper.cs
- IteratorDescriptor.cs
- PermissionToken.cs
- Size.cs
- InkPresenter.cs
- ChangeTracker.cs
- VersionedStreamOwner.cs
- PackUriHelper.cs
- PenLineJoinValidation.cs
- XmlSchemaExternal.cs
- FileSystemInfo.cs
- EventLogTraceListener.cs
- CodeDomLocalizationProvider.cs
- ChangePassword.cs
- PointConverter.cs
- PersonalizationProviderHelper.cs
- contentDescriptor.cs
- TextBreakpoint.cs
- ReadOnlyDictionary.cs