Beispiel #1
0
        static ContentControl3D()
        {
            DefaultStyleKeyProperty.OverrideMetadata(
                typeof (ContentControl3D),
                new FrameworkPropertyMetadata(typeof (ContentControl3D)));

            AnimationLengthProperty =
                DependencyProperty.Register(
                    "AnimationLength",
                    typeof (int),
                    typeof (ContentControl3D),
                    new UIPropertyMetadata(600, OnAnimationLengthChanged));

            BackContentProperty = DependencyProperty.Register(
                "BackContent",
                typeof (object),
                typeof (ContentControl3D));

            BackContentTemplateProperty = DependencyProperty.Register(
                "BackContentTemplate",
                typeof (DataTemplate),
                typeof (ContentControl3D),
                new UIPropertyMetadata(null));

            IsFrontInViewPropertyKey = DependencyProperty.RegisterReadOnly(
                "IsFrontInView",
                typeof (bool),
                typeof (ContentControl3D),
                new UIPropertyMetadata(true));
            IsFrontInViewProperty = IsFrontInViewPropertyKey.DependencyProperty;
        }
 internal ReverseInheritProperty(
     DependencyPropertyKey flagKey,
     CoreFlags flagCache,
     CoreFlags flagChanged)
     : this(flagKey, flagCache, flagChanged, CoreFlags.None, CoreFlags.None)
 {
 }
        static TransitionControl()
        {
            DefaultStyleKeyProperty.OverrideMetadata(
            typeof(TransitionControl),
            new FrameworkPropertyMetadata(typeof(TransitionControl)));

            TransitionEffectProperty = DependencyProperty.Register(
               "TransitionEffect",
               typeof(TransitionEffects),
               typeof(TransitionControl),
               new FrameworkPropertyMetadata(TransitionEffects.None));

            StaleContentProperty = DependencyProperty.Register(
            "StaleContent",
            typeof(Object),
            typeof(TransitionControl),
            new FrameworkPropertyMetadata(null));

            ContentControl.ContentProperty.OverrideMetadata(
            typeof(TransitionControl),
            new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnContentChanged)));

            IsContentChangedPropertyKey = DependencyProperty.RegisterReadOnly(
               "IsContentChanged",
               typeof(Boolean),
               typeof(TransitionControl),
               new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));

            IsContentChangedProperty = IsContentChangedPropertyKey.DependencyProperty;
        }
 static WaitIndicator() {
     Type ownerType = typeof(WaitIndicator);
     DeferedVisibilityProperty = DependencyProperty.Register("DeferedVisibility", typeof(bool), ownerType, new PropertyMetadata(false, OnDeferedVisibilityPropertyChanged));
     ShowShadowProperty = DependencyProperty.Register("ShowShadow", typeof(bool), ownerType, new PropertyMetadata(true));
     ContentPaddingProperty = DependencyProperty.Register("ContentPadding", typeof(Thickness), ownerType, new PropertyMetadata(new Thickness()));
     ActualContentPropertyKey = DependencyProperty.RegisterReadOnly("ActualContent", typeof(object), ownerType, new FrameworkPropertyMetadata(null));
     ActualContentProperty = ActualContentPropertyKey.DependencyProperty;
 }
 /// <summary>
 /// Initializes static members of the LicensePage class.
 /// </summary>
 static LicensePage()
 {
     _MustBeShownPropertyKey = DependencyProperty.RegisterReadOnly(
         "MustBeShown",
         typeof(bool),
         typeof(LicensePage),
         new PropertyMetadata(false));
     MustBeShownProperty = _MustBeShownPropertyKey.DependencyProperty;
 }
        static AutoHideChannel()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(AutoHideChannel), new FrameworkPropertyMetadata(typeof(AutoHideChannel)));

            //Register Dependency Properties
            ChannelWidthProperty = DependencyProperty.RegisterReadOnly("ChannelWidth", typeof(double), typeof(AutoHideChannel), new UIPropertyMetadata(0d));
            ChannelHeightProperty = DependencyProperty.RegisterReadOnly("ChannelHeight", typeof(double), typeof(AutoHideChannel), new UIPropertyMetadata(0d));
            CurrentWindowViewProperty = DependencyProperty.RegisterReadOnly("CurrentWindowView", typeof(View), typeof(AutoHideChannel), new UIPropertyMetadata(null));
        }
Beispiel #7
0
 static FormulaControl()
 {
     var registator = new DependencyPropertyRegistator<FormulaControl>();
     FormulaProperty = registator.Register<string>("Formula", propertyChanged:FormulaChanged, coerceValueCallback:OnFormulaCoerceCallback);
     FormulaVisualPropertyKey = registator.RegisterReadOnly<DrawingVisual>("FormulaVisual");
     EditableNowPropertyKey = registator.RegisterReadOnly<bool>("EditableNow");
     FormulaVisualProperty = FormulaVisualPropertyKey.DependencyProperty;
     EditableNowProperty = EditableNowPropertyKey.DependencyProperty;
 }
Beispiel #8
0
 static AlignPart()
 {
     AlignedPartsPropertyKey = DependencyProperty.RegisterReadOnly("AlignedParts", typeof(PartRefSet), typeof(AlignPart),
         new PropertyMetadata(default(PartRefSet),
         (o, e) =>
         {
             var _this = (AlignPart)o;
             //_this.CoerceValue(dps.TextProperty);
         }));
 }
		static DragDropViewInfo() {
			Type ownerType = typeof(DragDropViewInfo);
			DraggingRowsPropertyKey = DependencyPropertyManager.RegisterReadOnly("DraggingRows", typeof(IList), ownerType, new UIPropertyMetadata(null));
			DraggingRowsProperty = DraggingRowsPropertyKey.DependencyProperty;
			DropTargetTypePropertyKey = DependencyPropertyManager.RegisterReadOnly("DropTargetType", typeof(DropTargetType), ownerType, new UIPropertyMetadata(DropTargetType.None));
			DropTargetTypeProperty = DropTargetTypePropertyKey.DependencyProperty;
			DropTargetRowPropertyKey = DependencyPropertyManager.RegisterReadOnly("DropTargetRow", typeof(object), ownerType, new UIPropertyMetadata(null));
			DropTargetRowProperty = DropTargetRowPropertyKey.DependencyProperty;
			GroupInfoPropertyKey = DependencyPropertyManager.RegisterReadOnly("GroupInfo", typeof(IList<GroupInfo>), ownerType, new UIPropertyMetadata(null));
			GroupInfoProperty = GroupInfoPropertyKey.DependencyProperty;
			FirstDraggingObjectPropertyKey = DependencyPropertyManager.RegisterReadOnly("FirstDraggingObject", typeof(object), ownerType, new UIPropertyMetadata(null));
			FirstDraggingObjectProperty = FirstDraggingObjectPropertyKey.DependencyProperty;
		}
        static TransitionPresenter()
        {
            FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(
                typeof(TransitionPresenter), new FrameworkPropertyMetadata(typeof(TransitionPresenter)));

            //Registering RoutedEvents and Dependency Properties
            PreviousTransitionStartedEvent = EventManager.RegisterRoutedEvent("PreviousTransitionStarted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
            PreviousTransitionEndedEvent = EventManager.RegisterRoutedEvent("PreviousTransitionEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
            NextTransitionStartedEvent = EventManager.RegisterRoutedEvent("NextTransitionStarted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
            NextTransitionEndedEvent = EventManager.RegisterRoutedEvent("NextTransitionEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
            IsSelectTransitionRunningPropertyKey = DependencyProperty.RegisterReadOnly("IsSelectTransitionRunning", typeof(bool), typeof(TransitionPresenter), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(TransitionPresenter.OnIsSelectTransitionRunningChanged)));
            IsSelectTransitionRunningProperty = IsSelectTransitionRunningPropertyKey.DependencyProperty;
        }
 internal ReverseInheritProperty(
     DependencyPropertyKey flagKey,
     CoreFlags flagCache,
     CoreFlags flagChanged,
     CoreFlags flagOldOriginCache,
     CoreFlags flagNewOriginCache)
 {
     FlagKey = flagKey;
     FlagCache = flagCache;
     FlagChanged = flagChanged;
     FlagOldOriginCache = flagOldOriginCache;
     FlagNewOriginCache = flagNewOriginCache;
 }
Beispiel #12
0
 // Methods
 static QuickLink()
 {
     LinkProperty = DependencyProperty.Register("Link", typeof(IQuickLink), typeof(QuickLink), new PropertyMetadata((sender, args) => ((QuickLink)sender).UpdateIsDefault()));
     IsDefaultLinkPropertyKey = DependencyProperty.RegisterReadOnly("IsDefaultLink", typeof(bool), typeof(QuickLink), new PropertyMetadata(false));
     IsDefaultLinkProperty = IsDefaultLinkPropertyKey.DependencyProperty;
     StripProperty = DependencyProperty.Register("Strip", typeof(MenuStrip), typeof(QuickLink), new PropertyMetadata(delegate(DependencyObject sender, DependencyPropertyChangedEventArgs args)
     {
         QuickLink link = (QuickLink)sender;
         DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(MenuStrip.DefaultLinkProperty, typeof(MenuStrip));
         if (args.OldValue != null)
         {
             descriptor.RemoveValueChanged(args.OldValue, new EventHandler(link.DefaultLinkPropertyChanged));
             MenuStrip oldValue = (MenuStrip)args.OldValue;
             oldValue.MouseEnter -= new MouseEventHandler(link.Strip_MouseEnter);
             oldValue.MouseLeave -= new MouseEventHandler(link.Strip_MouseLeave);
         }
         if (args.NewValue != null)
         {
             descriptor.AddValueChanged(args.NewValue, new EventHandler(link.DefaultLinkPropertyChanged));
             link.UpdateIsDefault();
             MenuStrip newValue = (MenuStrip)args.NewValue;
             newValue.MouseEnter += new MouseEventHandler(link.Strip_MouseEnter);
             newValue.MouseLeave += new MouseEventHandler(link.Strip_MouseLeave);
         }
     }));
     NormalisedNonFocusImageProperty = DependencyProperty.Register("NormalisedNonFocusImage", typeof(ImageSource), typeof(QuickLink));
     NonFocusImageProperty = DependencyProperty.Register("NonFocusImage", typeof(ImageSource), typeof(QuickLink), new PropertyMetadata(delegate(DependencyObject sender, DependencyPropertyChangedEventArgs args)
     {
         QuickLink link = (QuickLink)sender;
         ImageSource imageSource = (ImageSource)args.NewValue;
         ImageSource image = link.Link.Image;
         if (((imageSource != null) && (image != null)) && ((imageSource.Width != image.Width) || (imageSource.Height != image.Height)))
         {
             double x = (image.Width - imageSource.Width) / 2.0;
             double y = (image.Height - imageSource.Height) / 2.0;
             DrawingVisual visual = new DrawingVisual();
             using (DrawingContext context = visual.RenderOpen())
             {
                 context.DrawImage(imageSource, new Rect(x, y, imageSource.Width, imageSource.Height));
             }
             RenderTargetBitmap bitmap = new RenderTargetBitmap((int)image.Width, (int)image.Height, 96.0, 96.0, PixelFormats.Default);
             bitmap.Render(visual);
             link.SetValue(NormalisedNonFocusImageProperty, bitmap);
         }
         else
         {
             link.SetValue(NormalisedNonFocusImageProperty, imageSource);
         }
     }));
 }
Beispiel #13
0
        static TreeGridColumnHeader()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(typeof(TreeGridColumnHeader)));
            ContentControl.ContentTemplateProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
            ContentControl.ContentTemplateSelectorProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
            FrameworkElement.StyleProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
            FrameworkElement.ContextMenuProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
            FrameworkElement.ToolTipProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
            UIElement.FocusableProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(BooleanBoxes.False));

            ColumnPropertyKey = DependencyProperty.RegisterReadOnly("Column", typeof(TreeGridColumn), typeof(TreeGridColumnHeader), null);
            ColumnProperty = ColumnPropertyKey.DependencyProperty;
            RolePropertyKey = DependencyProperty.RegisterReadOnly("Role", typeof(TreeGridColumnHeaderRole), typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(TreeGridColumnHeaderRole.Normal));
            RoleProperty = RolePropertyKey.DependencyProperty;
        }
        /// <summary>
        /// Clears the local value of the read only property.
        /// </summary>
        /// <param name="element">The element to clear the value to.</param>
        /// <param name="key">The key for the dependency property to be cleared.</param>
        public static void ClearValue(this DependencyObject element, DependencyPropertyKey key)
        {
            if (key == null)
                return;

            try
            {
                readonlyDPThatCanBeChanged.Add(key.DependencyProperty);
                if (element != null)
                    element.ClearValue(key.DependencyProperty);
            }
            finally
            {
                readonlyDPThatCanBeChanged.Remove(key.DependencyProperty);
            }
        }
Beispiel #15
0
 static WPFUtils()
 {
     IsGridSortableProperty = DependencyProperty.RegisterAttached(
         "IsGridSortable",
         typeof(Boolean),
         typeof(WPFUtils),
         new PropertyMetadata(new PropertyChangedCallback(OnRegisterSortableGrid)));
     LastSortDirectionPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
         "LastSortDirection",
         typeof(ListSortDirection),
         typeof(WPFUtils),
         new PropertyMetadata());
     LastSortedPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
         "LastSorted",
         typeof(GridViewColumnHeader),
         typeof(WPFUtils),
         new PropertyMetadata());
 }
Beispiel #16
0
        static PaneNavigator()
        {
            DefaultStyleKeyProperty.OverrideMetadata(
                typeof(PaneNavigator), new FrameworkPropertyMetadata(typeof(PaneNavigator)));

            PaneWidthPropertyKey = DependencyProperty.RegisterReadOnly(
                "PaneWidth", typeof(double), typeof(PaneNavigator), new FrameworkPropertyMetadata());

            VisibleItemsProperty = DependencyProperty.Register(
                "VisibleItems", typeof(int), typeof(PaneNavigator),
                new FrameworkPropertyMetadata(2, FrameworkPropertyMetadataOptions.AffectsRender));

            IsCurrentPanePropertyKey = DependencyProperty.RegisterAttachedReadOnly(
                "IsCurrentPane", typeof(bool), typeof(PaneNavigator),
               new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));

            FirstPaneProperty = DependencyProperty.Register(
                "FirstPane", typeof(object), typeof(PaneNavigator),
                new PropertyMetadata(PaneHelpers.HandleFirstPaneChanged));
        }
		static AutoComplete()
		{
			AutoCompleteInstancePropertyKey = DependencyProperty.RegisterAttachedReadOnly(
				"AutoCompleteInstance",
				typeof( AutoComplete ),
				typeof( AutoComplete ),
				new FrameworkPropertyMetadata( null ) );

			AutoCompleteInstance = AutoCompleteInstancePropertyKey.DependencyProperty;

			UserTextProperty = DependencyProperty.RegisterAttached( "UserText",
				typeof( object ),
				typeof( AutoComplete ),
				new FrameworkPropertyMetadata( null, OnUserTextPropertyChanged )
				{
					BindsTwoWayByDefault = true
				} );

			SourceProperty = DependencyProperty.RegisterAttached( "Source",
				typeof( object ),
				typeof( AutoComplete ),
				new FrameworkPropertyMetadata( null, OnSourcePropertyChanged ) );
			
			FilterPathProperty = DependencyProperty.RegisterAttached( "FilterPath",
				typeof( AutoCompleteFilterPathCollection ),
				typeof( AutoComplete ),
				new FrameworkPropertyMetadata( null ) );
			
			ItemTemplateProperty = DependencyProperty.RegisterAttached( "ItemTemplate",
			   typeof( DataTemplate ), 
			   typeof( AutoComplete ), 
			   new FrameworkPropertyMetadata( null, new PropertyChangedCallback( OnItemTemplatePropertyChanged ) ) );

			ChoosenItemProperty = DependencyProperty.RegisterAttached( "ChoosenItem",
				typeof( Object ),
				typeof( AutoComplete ),
				new FrameworkPropertyMetadata( null )
				{
					BindsTwoWayByDefault = true
				} );
		}
        static SortableListBehaviour()
        {
            IsGridSortableProperty = 
                DependencyProperty.RegisterAttached(
                    "IsGridSortable",
                    typeof(Boolean),
                    typeof(SortableListBehaviour),
                    new PropertyMetadata(
                        new PropertyChangedCallback(
                            OnRegisterSortableGrid)));

            LastSortDirectionPropertyKey = 
                DependencyProperty.RegisterAttachedReadOnly(
                    "LastSortDirection",
                    typeof(ListSortDirection),
                    typeof(SortableListBehaviour),
                    new PropertyMetadata());

            LastSortedPropertyKey = 
                DependencyProperty.RegisterAttachedReadOnly(
                    "LastSorted",
                    typeof(GridViewColumnHeader),
                    typeof(SortableListBehaviour),
                    new PropertyMetadata());

            GridSortablePrefixProperty = 
                DependencyProperty.RegisterAttached(
                    "GridSortablePrefix",
                    typeof(string),
                    typeof(SortableListBehaviour),
                    new PropertyMetadata(
                        new PropertyChangedCallback(
                            OnRegisterSortableGridPrefix)));

            SortValueProperty = 
                DependencyProperty.RegisterAttached(
                    "SortValue",
                    typeof(string),
                    typeof(SortableListBehaviour),
                    new PropertyMetadata());
        }
Beispiel #19
0
        static PaneNavigator()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(PaneNavigator),
                                                     new FrameworkPropertyMetadata(typeof(PaneNavigator)));
            PaneWidthPropertyKey = DependencyProperty.RegisterReadOnly("PaneWidth", typeof(double),
                                                                       typeof(PaneNavigator),
                                                                       new FrameworkPropertyMetadata());
            VisibleItemsProperty = DependencyProperty.Register("VisibleItems", typeof(int), typeof(PaneNavigator),
                                                               new FrameworkPropertyMetadata(2,
                                                                                             FrameworkPropertyMetadataOptions
                                                                                                 .AffectsRender));
            MinimumItemsProperty = DependencyProperty.Register("MinimumItems", typeof(int), typeof(PaneNavigator),
                                                               new FrameworkPropertyMetadata(1));
            IsCurrentPanePropertyKey = DependencyProperty.RegisterAttachedReadOnly("IsCurrentPane", typeof(bool),
                                                                           typeof(PaneNavigator),
                                                                           new FrameworkPropertyMetadata(false,
                                                                                                         FrameworkPropertyMetadataOptions
                                                                                                             .Inherits));
            HorizontalScrollIsAttachedProperty = DependencyProperty.RegisterAttached("HorizontalScrollIsAttached", typeof(bool),
                                                                             typeof(PaneNavigator),
                                                                             new FrameworkPropertyMetadata(false, HorizontalScrollIsAttachedChanged));
            HorizontalScrollOffsetProperty = DependencyProperty.RegisterAttached("HorizontalScrollOffset",
                                                                                 typeof(double), typeof(PaneNavigator),
                                                                                 new FrameworkPropertyMetadata((double)0,
                                                                                                               FrameworkPropertyMetadataOptions
                                                                                                                   .
                                                                                                                   AffectsArrange |
                                                                                                               FrameworkPropertyMetadataOptions
                                                                                                                   .
                                                                                                                   AffectsMeasure,
                                                                                                               HorizontalScrollChanged));
            IsCurrentPaneProperty = IsCurrentPanePropertyKey.DependencyProperty;
            PaneScrollForwardEvent = EventManager.RegisterRoutedEvent("PaneScrollForward", RoutingStrategy.Bubble, typeof(RoutedEventHandler),
                                             typeof(PaneNavigator));
            PaneScrollBackEvent = EventManager.RegisterRoutedEvent("PaneScrollBack", RoutingStrategy.Bubble, typeof(RoutedEventHandler),
                                             typeof(PaneNavigator));
            FirstPaneProperty = DependencyProperty.Register("FirstPane", typeof (object), typeof (PaneNavigator),
                                                            new PropertyMetadata(HandleFirstPaneChanged));

        }
Beispiel #20
0
 public IDependencyPropertyValueEntry GetValueEntry(DependencyPropertyKey dependencyPropertyKey)
 {
     VerifyReadOnlyProperty(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey);
     return(GetInitializedValueEntry(dependencyPropertyKey.DependencyProperty));
 }
Beispiel #21
0
 public void ClearValue(DependencyPropertyKey dependencyPropertyKey, BaseValueSource source = BaseValueSource.Local)
 {
     ClearValue(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey, source);
 }
Beispiel #22
0
        /// <summary> 
        ///     Called by SetValue or ClearValue to verify that the property
        /// can be changed. 
        /// </summary> 
        private PropertyMetadata SetupPropertyChange(DependencyPropertyKey key, out DependencyProperty dp)
        { 
            if ( key != null )
            {
                dp = key.DependencyProperty;
 
                if ( dp != null )
                { 
                    dp.VerifyReadOnlyKey(key); 

                    // Get type-specific metadata for this property 
                    return dp.GetMetadata(DependencyObjectType);
                }
                else
                { 
                    throw new ArgumentException(SR.Get(SRID.ReadOnlyKeyNotAuthorized, dp.Name));
                } 
            } 
            else
            { 
                throw new ArgumentNullException("key");
            }
        }
Beispiel #23
0
        public static bool IsValidReadOnlyKey(DependencyPropertyKey key)
        {
            DependencyPropertyKey registeredKey;

            return(registeredReadOnlyPropertiesKey.TryGetValue(key.DependencyProperty.hashKey, out registeredKey) && registeredKey == key);
        }
		public void OverrideMetadata (Type forType, PropertyMetadata typeMetadata, DependencyPropertyKey key)
		{
			if (forType == null)
				throw new ArgumentNullException ("forType");
			if (typeMetadata == null)
				throw new ArgumentNullException ("typeMetadata");


			// further checking?  should we check
			// key.DependencyProperty == this?

			typeMetadata.DoMerge (DefaultMetadata, this, forType);
			metadataByType.Add (forType, typeMetadata);
		}
Beispiel #25
0
 [FriendAccessAllowed] // Built into Base, also used by Core and Framework. 
 internal void SetValue(DependencyPropertyKey dp, bool value)
 {
     SetValue(dp, MS.Internal.KnownBoxes.BooleanBoxes.Box(value));
 } 
Beispiel #26
0
 private static void VerifyReadOnlyProperty(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey)
 {
     if (dependencyProperty.IsReadOnly &&
         (dependencyPropertyKey == null || dependencyPropertyKey.DependencyProperty != dependencyProperty || !DependencyProperty.IsValidReadOnlyKey(dependencyPropertyKey)))
     {
         throw new Granular.Exception("Can't modify the read-only dependency property \"{0}\" without its key", dependencyProperty);
     }
 }
Beispiel #27
0
 public void SetValue(DependencyPropertyKey dependencyPropertyKey, object value, BaseValueSource source = BaseValueSource.Local)
 {
     SetValue(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey, value, source: source);
 }
        public void OverrideMetadata(Type ownerType, PropertyMetadata defaultMetadata, DependencyPropertyKey key)
        {
            if (key.DependencyProperty != this)
            {
                throw new InvalidOperationException();
            }

            OverrideMetadata(ownerType, defaultMetadata);
        }
Beispiel #29
0
 public bool ContainsValue(DependencyPropertyKey dependencyPropertyKey)
 {
     return(ContainsValue(dependencyPropertyKey.DependencyProperty));
 }
Beispiel #30
0
 public void SetValueBase(DependencyPropertyKey key, object value)
 {
     throw new NotImplementedException();
 }
Beispiel #31
0
 public void SetValue(DependencyPropertyKey key, object value)
 {
     SetValue(key.DependencyProperty, value);
 }
Beispiel #32
0
 public void ClearValue(DependencyPropertyKey key)
 {
     ClearValue(key.DependencyProperty);
 }
Beispiel #33
0
 public void SetCurrentValue(DependencyPropertyKey dependencyPropertyKey, object value)
 {
     SetValue(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey, value, setCurrentValue: true);
 }
Beispiel #34
0
        private void ClearValue(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey, BaseValueSource source)
        {
            VerifyReadOnlyProperty(dependencyProperty, dependencyPropertyKey);

            IDependencyPropertyValueEntry entry;
            if (!entries.TryGetValue(dependencyProperty, out entry))
            {
                return;
            }

            IExpression expression = entry.GetBaseValue((int)source, false) as IExpression;
            if (expression is IDisposable)
            {
                ((IDisposable)expression).Dispose();
            }

            entry.ClearBaseValue((int)source);
            entry.ClearCurrentValue();
        }
Beispiel #35
0
 public void SetValue(System.Windows.DependencyPropertyKey key, object value)
 {
     inter.SetValue(key, value);
 }
Beispiel #36
0
        private void SetValue(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey, object value, bool setCurrentValue = false, BaseValueSource source = BaseValueSource.Unknown)
        {
            VerifyReadOnlyProperty(dependencyProperty, dependencyPropertyKey);

            IExpressionProvider newExpressionProvider = value as IExpressionProvider;
            if (newExpressionProvider == null && !dependencyProperty.IsValidValue(value))
            {
                return; // invalid value
            }

            IDependencyPropertyValueEntry entry = GetInitializedValueEntry(dependencyProperty);

            IExpression oldExpression = setCurrentValue ?
                entry.GetBaseValue(false) as IExpression : // current value may be set in the top priority expression
                entry.GetBaseValue((int)source, false) as IExpression;

            if (newExpressionProvider != null)
            {
                value = newExpressionProvider.CreateExpression(this, dependencyProperty);
            }
            else if (oldExpression != null && oldExpression.SetValue(value))
            {
                return; // value (current or not) was set in the existing expression, nothing else to do
            }

            if (setCurrentValue)
            {
                entry.SetCurrentValue(value);
                return; // base value isn't changed
            }

            if (oldExpression is IDisposable) // expression is being replaced
            {
                ((IDisposable)oldExpression).Dispose();
            }

            entry.SetBaseValue((int)source, value);
            entry.ClearCurrentValue();
        }
Beispiel #37
0
 public object GetValue(DependencyPropertyKey dependencyPropertyKey)
 {
     return(GetValue(dependencyPropertyKey.DependencyProperty));
 }
Beispiel #38
0
 public void ClearValue(DependencyPropertyKey dependencyPropertyKey, BaseValueSource source = BaseValueSource.Local)
 {
     ClearValue(dependencyPropertyKey.DependencyProperty, dependencyPropertyKey, source);
 }
 private void SafeSetValue(DependencyPropertyKey property, object value) {
     if (Dispatcher.CheckAccess()) {
         SetValue(property, value);
     } else {
         Dispatcher.BeginInvoke((Action)(() => SetValue(property, value)));
     }
 }
Beispiel #40
0
 public bool ContainsValue(DependencyPropertyKey dependencyPropertyKey)
 {
     return ContainsValue(dependencyPropertyKey.DependencyProperty);
 }
Beispiel #41
0
        /// <summary> 
        ///     Sets the local value of a property 
        /// </summary>
        public void SetValue(DependencyPropertyKey key, object value) 
        {
            // Do not allow foreign threads access.
            // (This is a noop if this object is not assigned to a Dispatcher.)
            // 
            this.VerifyAccess();
 
            DependencyProperty dp; 

            // Cache the metadata object this method needed to get anyway. 
            PropertyMetadata metadata = SetupPropertyChange(key, out dp);

            // Do standard property set
            SetValueCommon(dp, value, metadata, false /* coerceWithDeferredReference */, false /* coerceWithCurrentValue */, OperationType.Unknown, false /* isInternal */); 
        }
Beispiel #42
0
 private static void VerifyReadOnlyProperty(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey)
 {
     if (dependencyProperty.IsReadOnly &&
         (dependencyPropertyKey == null || dependencyPropertyKey.DependencyProperty != dependencyProperty || !DependencyProperty.IsValidReadOnlyKey(dependencyPropertyKey)))
     {
         throw new Granular.Exception("Can't modify the readonly dependency property \"{0}\" without its key", dependencyProperty);
     }
 }
Beispiel #43
0
        /// <summary> 
        ///     Clears the local value of a property
        /// </summary> 
        public void ClearValue(DependencyPropertyKey key) 
        {
            // Do not allow foreign threads to clear properties. 
            // (This is a noop if this object is not assigned to a Dispatcher.)
            //
            this.VerifyAccess();
 
            DependencyProperty dp;
 
            // Cache the metadata object this method needed to get anyway. 
            PropertyMetadata metadata = SetupPropertyChange(key, out dp);
 
            EntryIndex entryIndex = LookupEntry(dp.GlobalIndex);

            ClearValueCommon(entryIndex, dp, metadata);
        } 
Beispiel #44
0
 public void ClearValue(System.Windows.DependencyPropertyKey key)
 {
     inter.ClearValue(key);
 }