System.Windows.DependencyProperty.RegisterAttached C# (CSharp) Method

RegisterAttached() public static method

public static RegisterAttached ( string name, Type propertyType, Type ownerType, System.Windows.PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback ) : DependencyProperty
name string
propertyType Type
ownerType Type
defaultMetadata System.Windows.PropertyMetadata
validateValueCallback ValidateValueCallback
return DependencyProperty
        public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType,
								  PropertyMetadata defaultMetadata,
								  ValidateValueCallback validateValueCallback)
        {
            DependencyProperty dp = new DependencyProperty(true, name, propertyType, ownerType,
                                       defaultMetadata, validateValueCallback);
            DependencyObject.register(ownerType, dp);
            return dp;
        }

Same methods

DependencyProperty::RegisterAttached ( string name, Type propertyType, Type ownerType ) : DependencyProperty
DependencyProperty::RegisterAttached ( string name, Type propertyType, Type ownerType, System.Windows.PropertyMetadata defaultMetadata ) : DependencyProperty

Usage Example

Esempio n. 1
0
        public static void RegisterForNotification([NotNull] this FrameworkElement element, string PropertyName, PropertyChangedCallback callback)
        {
            var binding = new Binding(PropertyName)
            {
                Source = element
            };
            var prop = DependencyProperty.RegisterAttached($"ListenAttached{PropertyName}",
                                                           typeof(object),
                                                           element.GetType(),
                                                           new PropertyMetadata(callback));

            element.SetBinding(prop, binding);
        }
All Usage Examples Of System.Windows.DependencyProperty::RegisterAttached