Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RoutedEvent"/> class.
        /// </summary>
        /// <param name="id">The event's unique identifier within the routed events system.</param>
        /// <param name="name">The routed event's name.</param>
        /// <param name="uvssName">The dependency property's name within the UVSS styling system.</param>
        /// <param name="routingStrategy">The routed event's routing strategy.</param>
        /// <param name="delegateType">The routed event's delegate type.</param>
        /// <param name="ownerType">The routed event's owner type.</param>
        internal RoutedEvent(Int64 id, String name, String uvssName, RoutingStrategy routingStrategy, Type delegateType, Type ownerType)
        {
            this.id                 = id;
            this.name               = name;
            this.uvssName           = uvssName ?? UvssNameGenerator.GenerateUvssName(name);
            this.routingStrategy    = routingStrategy;
            this.delegateType       = delegateType;
            this.ownerType          = ownerType;
            this.invocationDelegate = RoutedEventInvocation.CreateInvocationDelegate(this);

            this.raisedNotificationServer = new RoutedEventRaisedNotificationServer(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DependencyProperty"/> class.
        /// </summary>
        /// <param name="id">The dependency property's unique identifier.</param>
        /// <param name="name">The dependency property's name.</param>
        /// <param name="uvssName">The dependency property's name within the UVSS styling system.</param>
        /// <param name="propertyType">The dependency property's value type.</param>
        /// <param name="ownerType">The dependency property's owner type.</param>
        /// <param name="metadata">The dependency property's metadata.</param>
        /// <param name="isReadOnly">A value indicating whether this is a read-only dependency property.</param>
        /// <param name="isAttached">A value indicating whether this is an attached property.</param>
        internal DependencyProperty(Int64 id, String name, String uvssName, Type propertyType, Type ownerType, PropertyMetadata metadata, Boolean isReadOnly = false, Boolean isAttached = false)
        {
            this.id              = id;
            this.name            = name;
            this.uvssName        = uvssName ?? UvssNameGenerator.GenerateUvssName(name);
            this.propertyType    = propertyType;
            this.underlyingType  = Nullable.GetUnderlyingType(propertyType);
            this.ownerType       = ownerType;
            this.defaultMetadata = metadata ?? (PropertyMetadata)typeof(PropertyMetadata <>).MakeGenericType(propertyType).GetField("Empty").GetValue(null);
            this.isReadOnly      = isReadOnly;
            this.isAttached      = isAttached;
            this.styleSetter     = CreateStyleSetter();

            this.changeNotificationServer = new DependencyPropertyChangeNotificationServer(this);
        }