private static void VerifyNotRegistered(DependencyPropertyHashKey key, DependencyProperty dependencyProperty) { DependencyProperty registeredDependencyProperty; if (registeredProperties.TryGetValue(key, out registeredDependencyProperty)) { throw new Granular.Exception("Can't register dependency property \"{0}\", Type \"{1}\" already has a dependency property with the same name \"{2}\"", dependencyProperty, key.Owner.Name, registeredDependencyProperty); } }
private IDependencyPropertyValueEntry GetInitializedReadOnlyValueEntry(DependencyProperty dependencyProperty) { IDependencyPropertyValueEntry readOnlyEntry; if (readOnlyEntries.TryGetValue(dependencyProperty, out readOnlyEntry)) { return(readOnlyEntry); } readOnlyEntry = new ReadOnlyDependencyPropertyValueEntry(GetInitializedValueEntry(dependencyProperty)); readOnlyEntries.Add(dependencyProperty, readOnlyEntry); return(readOnlyEntry); }
public bool ContainsValue(DependencyProperty dependencyProperty) { IDependencyPropertyValueEntry entry; if (!entries.TryGetValue(dependencyProperty, out entry)) { return(false); } return(entry.GetBaseValuePriority() > (int)BaseValueSource.Inherited); }
// Get event that is owned by containingType or one of its base classes public static RoutedEvent GetEvent(Type containingType, string eventName) { RoutedEvent routedEvent; while (containingType != null && containingType != typeof(Visual)) { System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(containingType.GetTypeHandle()); if (registeredEvents.TryGetValue(new RoutedEventHashKey(containingType, eventName), out routedEvent)) { return(routedEvent); } containingType = containingType.BaseType; } return(null); }
public static bool IsValidReadOnlyKey(DependencyPropertyKey key) { DependencyPropertyKey registeredKey; return(registeredReadOnlyPropertiesKey.TryGetValue(key.DependencyProperty.hashKey, out registeredKey) && registeredKey == key); }