Example #1
1
        public static void SetBindingObject(FrameworkElement obj, BindingMode mode, object source, DependencyProperty dp, string propertyName)
        {
            Type propertyType = source.GetType().GetProperty(propertyName).PropertyType;
            PropertyInfo info = source.GetType().GetProperty("RangeList");
            FANumberRangeRule rangeRule = null;
            if (info != null)
            {
                object value = info.GetValue(source, null);
                if (value != null)
                {
                    FALibrary.Utility.SerializableDictionary<string, FARange> dic =
                        (FALibrary.Utility.SerializableDictionary<string, FARange>)value;
                    if (dic.ContainsKey(propertyName))
                    {
                        rangeRule = new FANumberRangeRule(propertyType);
                        rangeRule.Range = dic[propertyName];
                        obj.Tag = rangeRule;
                        obj.Style = (Style)App.Current.Resources["TextBoxErrorStyle"];
                    }
                }
            }

            Binding bd = new Binding(propertyName);
            bd.Source = source;
            bd.Mode = mode;
            bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            if (rangeRule != null)
            {
                bd.NotifyOnValidationError = true;
                bd.ValidationRules.Add(rangeRule);
            }

            obj.SetBinding(dp, bd);
        }
Example #2
1
 internal static void SetBinding(this DependencyObject sourceObject, DependencyObject targetObject, DependencyProperty sourceProperty, DependencyProperty targetProperty)
 {
     Binding b = new Binding();
     b.Source = sourceObject;
     b.Path = new PropertyPath(sourceProperty);
     BindingOperations.SetBinding(targetObject, targetProperty, b);
 }
        static ImageButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton),
                new FrameworkPropertyMetadata(typeof(ImageButton)));

            ImageButton.OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation),
                typeof(ImageButton), new FrameworkPropertyMetadata(Orientation.Horizontal,
                FrameworkPropertyMetadataOptions.AffectsMeasure));

            ImageButton.ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ImageButton),
                new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender |
                FrameworkPropertyMetadataOptions.AffectsMeasure));

            ImageButton.IsToolStyleProperty = DependencyProperty.Register("IsToolStyle", typeof(bool), typeof(ImageButton),
                new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender
                | FrameworkPropertyMetadataOptions.AffectsArrange));

            ImageButton.ContentHorizontalAlignmentProperty = DependencyProperty.Register(
                "ContentHorizontalAlignment", typeof(HorizontalAlignment),
                typeof(ImageButton), new FrameworkPropertyMetadata(HorizontalAlignment.Center,
                FrameworkPropertyMetadataOptions.AffectsRender));

            ImageButton.ContentVerticalAlignmentProperty = DependencyProperty.Register(
                "ContentVerticalAlignment", typeof(VerticalAlignment),
                typeof(ImageButton), new FrameworkPropertyMetadata(VerticalAlignment.Center,
                FrameworkPropertyMetadataOptions.AffectsRender));
        }
Example #4
0
 static InputHelper()
 {
     InputBindingsProperty = DependencyProperty.RegisterAttached("InputBindings", typeof(ICollection), typeof(InputHelper), new FrameworkPropertyMetadata((d, e) =>
     {
         var element = d as UIElement;
         if (element != null)
         {
             element.InputBindings.Clear();
             element.InputBindings.AddRange(e.NewValue as ICollection);
             if (e.NewValue is INotifyCollectionChanged)
             {
                 ((INotifyCollectionChanged)e.NewValue).CollectionChanged += (x, y) =>
                 {
                     if (y.Action == NotifyCollectionChangedAction.Add || y.Action == NotifyCollectionChangedAction.Replace)
                     {
                         element.InputBindings.AddRange(y.NewItems as ICollection);
                     }
                     if (y.Action == NotifyCollectionChangedAction.Remove || y.Action == NotifyCollectionChangedAction.Replace)
                     {
                         foreach (InputBinding b in y.NewItems as ICollection)
                             element.InputBindings.Remove(b);
                     }
                     if (y.Action == NotifyCollectionChangedAction.Reset)
                     {
                         element.InputBindings.Clear();
                         element.InputBindings.AddRange(x as ICollection);
                     }
                 };
             }
         }
     }));
 }
 static LixeiraProperty()
 {
     var metadata = new FrameworkPropertyMetadata((ImageSource)null);
     ImageProperty = DependencyProperty.RegisterAttached("Image",
                                                         typeof(ImageSource),
                                                         typeof(LixeiraProperty), metadata);
 }
Example #6
0
        static PivotGridDemoModule()
        {
            Type ownerType = typeof(PivotGridDemoModule);

            PivotGridControlProperty = DependencyPropertyManager.Register("PivotGridControl", typeof(PivotGridControl),
                                                                          ownerType, new PropertyMetadata(null, OnPivotGridControlChanged));
        }
        /// <summary>
        /// Starts an animation to a particular value on the specified dependency property.
        /// You can pass in an event handler to call when the animation has completed.
        /// </summary>
        public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
        {
            double fromValue = (double)animatableElement.GetValue(dependencyProperty);

            DoubleAnimation animation = new DoubleAnimation();
            animation.From = fromValue;
            animation.To = toValue;
            animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);

            animation.Completed += delegate(object sender, EventArgs e)
            {
                //
                // When the animation has completed bake final value of the animation
                // into the property.
                //
                animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty));
                CancelAnimation(animatableElement, dependencyProperty);

                if (completedEvent != null)
                {
                    completedEvent(sender, e);
                }
            };

            animation.Freeze();

            animatableElement.BeginAnimation(dependencyProperty, animation);
        }
Example #8
0
        public static void UpdateBinding(this FrameworkElement instance, DependencyProperty prop)
        {
            var bindingExpression = instance.GetBindingExpression(prop);

            if (bindingExpression != null)
                bindingExpression.UpdateSource();
        }
        internal DependencyPropertyChangedEventArgs(
            DependencyProperty  property, 
            PropertyMetadata    metadata,
            bool                isAValueChange, 
            EffectiveValueEntry oldEntry, 
            EffectiveValueEntry newEntry,
            OperationType       operationType) 
        {
            _property             = property;
            _metadata             = metadata;
            _oldEntry             = oldEntry; 
            _newEntry             = newEntry;
 
            _flags = 0; 
            _operationType        = operationType;
            IsAValueChange        = isAValueChange; 

            // This is when a mutable default is promoted to a local value. On this operation mutable default
            // value acquires a freezable context. However this value promotion operation is triggered
            // whenever there has been a sub property change to the mutable default. Eg. Adding a TextEffect 
            // to a TextEffectCollection instance which is the mutable default. Since we missed the sub property
            // change due to this add, we flip the IsASubPropertyChange bit on the following change caused by 
            // the value promotion to coalesce these operations. 
            IsASubPropertyChange = (operationType == OperationType.ChangeMutableDefaultValue);
        } 
 /// <summary>
 /// Class ctor
 /// </summary>
 static ToolBarButton()
 {
     ImageProperty        = DependencyProperty.Register("Image",
                                                        typeof(ImageSource),
                                                        typeof(ToolBarButton),
                                                        new FrameworkPropertyMetadata((ImageSource)null,
                                                                                      FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure,
                                                                                      ImageChanged));
     DisabledImageProperty = DependencyProperty.Register("DisabledImage",
                                                 typeof(ImageSource),
                                                 typeof(ToolBarButton),
                                                 new FrameworkPropertyMetadata((ImageSource)null,
                                                                               FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure,
                                                                               DisabledImageChanged));
     FlipProperty         = DependencyProperty.Register("Flip",
                                                        typeof(bool),
                                                        typeof(ToolBarButton),
                                                        new FrameworkPropertyMetadata(false,
                                                                                      FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure,
                                                                                      FlipChanged));
     TextProperty          = DependencyProperty.Register("Text",
                                                                 typeof(String),
                                                                 typeof(ToolBarButton),
                                                                 new FrameworkPropertyMetadata("",
                                                                                               FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.Inherits,
                                                                                               TextChanged));
     DisplayStyleProperty  = DependencyProperty.RegisterAttached("DisplayStyle",
                                                                  typeof(DisplayStyleE),
                                                                  typeof(ToolBarButton),
                                                                  new FrameworkPropertyMetadata(DisplayStyleE.Text,
                                                                                                FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsParentArrange | FrameworkPropertyMetadataOptions.AffectsParentMeasure | FrameworkPropertyMetadataOptions.Inherits,
                                                                                                DisplayStyleChanged));
     IsEnabledProperty.OverrideMetadata(typeof(ToolBarButton), new FrameworkPropertyMetadata(true, new PropertyChangedCallback(IsEnabledChanged)));
 }
 static CoinFlipCounter()
 {
     TossProperty = DependencyProperty.Register("Toss", typeof(Boolean), typeof(CoinFlipCounter), new PropertyMetadata(true));
     Image1SourceProperty = DependencyProperty.Register("Image1Source", typeof(String), typeof(CoinFlipCounter), new PropertyMetadata(""));
     Image2SourceProperty = DependencyProperty.Register("Image1Source", typeof(String), typeof(CoinFlipCounter), new PropertyMetadata(""));
    
 }
Example #12
0
 static GraphElementBehavior()
 {
     IsSemiHighlightedProperty = IsSemiHighlightedPropertyKey.DependencyProperty;
     SemiHighlightInfoProperty = SemiHighlightInfoPropertyKey.DependencyProperty;
     HighlightInfoProperty = HighlightInfoPropertyKey.DependencyProperty;
     IsHighlightedProperty = IsHighlightedPropertyKey.DependencyProperty;
 }
 /// <summary>
 ///     Creates a new dependency property descriptor.  A note on perf:  We don't 
 ///     pass the property descriptor down as the default member descriptor here.  Doing
 ///     so takes the attributes off of the property descriptor, which can be costly if they
 ///     haven't been accessed yet.  Instead, we wait until someone needs to access our
 ///     Attributes property and demand create the attributes at that time.
 /// </summary>
 internal DependencyObjectPropertyDescriptor(DependencyProperty dp, Type ownerType)
     : base(string.Concat(dp.OwnerType.Name, ".", dp.Name), null) 
 {
     _dp = dp;
     _componentType = ownerType;
     _metadata = _dp.GetMetadata(ownerType);
 }
 static FocusScopeManager()
 {
     // Must do this explicitly because the default value of the FocusScopePriorityProperty depends on DefaultFocusScopePriority being properly initialized.
     FocusScopeManager.DefaultFocusScopePriority = Int32.MaxValue;
     FocusScopeManager.FocusScopePriorityProperty = DependencyProperty.RegisterAttached("FocusScopePriority", typeof(int), typeof(FocusScopeManager), new FrameworkPropertyMetadata(FocusScopeManager.DefaultFocusScopePriority, new PropertyChangedCallback(FocusScopeManager.FocusScopePriorityChanged)));
     FocusManager.FocusedElementProperty.OverrideMetadata(typeof(FrameworkElement), new PropertyMetadata(null, null, new CoerceValueCallback(FocusScopeManager.FocusManager_CoerceFocusedElement)));
 }
Example #15
0
        public OriginElement()
        {
            FrameworkPropertyMetadata meta = new FrameworkPropertyMetadata();
            meta.AffectsRender = true;

            OriginProperty = DependencyProperty.Register("Origin", typeof(Point), typeof(OriginElement), meta);
        }
 public static IDisposable PropertyChanged(
     this DependencyObject source,
     DependencyProperty property,
     Action<DependencyPropertyChangedEventArgs> onChanged = null)
 {
     return new DependencyPropertyListener(source, property, onChanged);
 }
        /// <summary>
        /// Replaces the content for a <see cref="DataField"/> with another control and updates the bindings.
        /// </summary>
        /// <param name="field">The <see cref="DataField"/> whose <see cref="TextBox"/> will be replaced.</param>
        /// <param name="newControl">The new control you're going to set as <see cref="DataField.Content" />.</param>
        /// <param name="dataBindingProperty">The control's property that will be used for data binding.</param>        
        /// <param name="bindingSetupFunction">
        ///  An optional <see cref="Action"/> you can use to change parameters on the newly generated binding before
        ///  it is applied to <paramref name="newControl"/>
        /// </param>
        /// <param name="sourceProperty">The source dependency property to use for the binding.</param>
        public static void ReplaceContent(this DataField field, FrameworkElement newControl, DependencyProperty dataBindingProperty, Action<Binding> bindingSetupFunction, DependencyProperty sourceProperty)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            if (newControl == null)
            {
                throw new ArgumentNullException("newControl");
            }

            // Construct new binding by copying existing one, and sending it to bindingSetupFunction
            // for any changes the caller wants to perform
            Binding newBinding = field.Content.GetBindingExpression(sourceProperty).ParentBinding.CreateCopy();

            if (bindingSetupFunction != null)
            {
                bindingSetupFunction(newBinding);
            }

            // Replace field
            newControl.SetBinding(dataBindingProperty, newBinding);
            field.Content = newControl;
        }
Example #18
0
        static DataPager()
        {
            PagedItemsSourceProperty = DependencyProperty.Register("PagedItemsSource"
                , typeof(IPagedCollectionView)
                , typeof(DataPager)
                , new FrameworkPropertyMetadata(new PropertyChangedCallback(PagedItemsSourceChanged)));
            TotalItemCountProperty = DependencyProperty.Register("TotalItemCount"
                , typeof(int)
                , typeof(DataPager));
            PageIndexProperty = DependencyProperty.Register("PageIndex"
                , typeof(int)
                , typeof(DataPager));
            PageCountProperty = DependencyProperty.Register("PageCount"
                , typeof(int)
                , typeof(DataPager));
            PageSizeProperty = DependencyProperty.Register("PageSize"
                , typeof(int)
                , typeof(DataPager));
            ResultsTextProperty = DependencyProperty.Register("ResultsText"
                , typeof(string)
                , typeof(DataPager));
            PageTextProperty = DependencyProperty.Register("PageText"
                , typeof(string)
                , typeof(DataPager));
            PageOfTextProperty = DependencyProperty.Register("PageOfText"
                , typeof(string)
                , typeof(DataPager));

            DefaultStyleKeyProperty.OverrideMetadata(typeof(DataPager), new FrameworkPropertyMetadata(typeof(DataPager)));
        }
		public XamlDependencyPropertyInfo(DependencyProperty property, bool isAttached)
		{
			Debug.Assert(property != null);
			this.property = property;
			this.isAttached = isAttached;
			this.isCollection = CollectionSupport.IsCollectionType(property.PropertyType);
		}
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var pvt = serviceProvider as IProvideValueTarget;
            if (pvt == null)
            {
                return null;
            }

            _frameworkElement = pvt.TargetObject as FrameworkElement;
            if (_frameworkElement == null)
            {
                return this;
            }

            _target = pvt.TargetProperty as DependencyProperty;
            if (_target == null)
            {
                return this;
            }

            _frameworkElement.DataContextChanged += FrameworkElement_DataContextChanged;

            var proxy = new Proxy();
            var binding = new Binding()
            {
                Source = proxy,
                Path = new PropertyPath("Value")
            };

            // Make sure we don't leak subscriptions
            _frameworkElement.Unloaded += (e, v) => _subscription.Dispose();

            return binding.ProvideValue(serviceProvider);
        }
Example #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WpfMemberToken"/> class.
        /// </summary>
        /// <param name="objectToObserve">The object to observe.</param>
        /// <param name="dependencyProperty">The dependency property.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="remainingPath">The remaining path.</param>
        /// <param name="callback">The callback.</param>
        /// <param name="pathNavigator">The path navigator.</param>
        public WpfMemberToken(DependencyObject objectToObserve, DependencyProperty dependencyProperty, string propertyName, string remainingPath, Action<object, string> callback, IPathNavigator pathNavigator)
            : base(objectToObserve, propertyName, remainingPath, callback, pathNavigator)
        {
            _dependencyProperty = dependencyProperty;

            AcquireTarget(objectToObserve);
        }
Example #22
0
 static WPFClickTypeWatch()
 {
     DefaultStyleKeyProperty.OverrideMetadata( typeof( WPFClickTypeWatch ), new FrameworkPropertyMetadata( typeof( WPFClickTypeWatch ) ) );
     ValueProperty = DependencyProperty.Register( "Value", typeof( int ), typeof( WPFClickTypeWatch ) );
     DisabledColorProperty = DependencyProperty.Register( "DisabledColor", typeof( LinearGradientBrush ), typeof( WPFClickTypeWatch ) );
     IsPausedProperty = DependencyProperty.Register( "IsPaused", typeof( bool ), typeof( WPFClickTypeWatch ) );
 }
Example #23
0
 static RichTextBlock()
 {
     //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
     //This style is defined in themes\generic.xaml
     DefaultStyleKeyProperty.OverrideMetadata(typeof(RichTextBlock), new FrameworkPropertyMetadata(typeof(RichTextBlock)));
     InlineProperty = DependencyProperty.Register("RichText", typeof(List<Inline>), typeof(RichTextBlock), new PropertyMetadata(null, new PropertyChangedCallback(OnInlineChanged)));
 }
        //------------------------------------------------------ 
        //
        //  Internal Methods 
        //
        //-----------------------------------------------------

        #region Internal Methods 

        // Returns non-null string if this value can be converted to a string, 
        // null otherwise. 
        internal static string GetStringValue(DependencyProperty property, object propertyValue)
        { 
            string stringValue = null;

            // Special cases working around incorrectly implemented type converters
            if (property == UIElement.BitmapEffectProperty) 
            {
                return null; // Always treat BitmapEffects as complex value 
            } 

            if (property == Inline.TextDecorationsProperty) 
            {
                stringValue = TextDecorationsFixup((TextDecorationCollection)propertyValue);
            }
            else if (typeof(CultureInfo).IsAssignableFrom(property.PropertyType)) //NumberSubstitution.CultureOverrideProperty 
            {
                stringValue = CultureInfoFixup(property, (CultureInfo)propertyValue); 
            } 

            if (stringValue == null) 
            {
                DPTypeDescriptorContext context = new DPTypeDescriptorContext(property, propertyValue);

                System.ComponentModel.TypeConverter typeConverter = System.ComponentModel.TypeDescriptor.GetConverter(property.PropertyType); 
                Invariant.Assert(typeConverter != null);
                if (typeConverter.CanConvertTo(context, typeof(string))) 
                { 
                    stringValue = (string)typeConverter.ConvertTo(
                        context, System.Globalization.CultureInfo.InvariantCulture, propertyValue, typeof(string)); 
                }
            }
            return stringValue;
        } 
Example #25
0
        // Existing GetPropertyValue for the TextDecorationCollection will return the first collection, even if it is empty.
        // this skips empty collections so we can get the actual value.
        // slightly modified code from https://social.msdn.microsoft.com/Forums/vstudio/en-US/3ac626cf-60aa-427f-80e9-794f3775a70e/how-to-tell-if-richtextbox-selection-is-underlined?forum=wpf
        public static object GetRealPropertyValue(this swd.TextRange textRange, sw.DependencyProperty formattingProperty, out swd.TextRange fullRange)
        {
            object value = null;

            fullRange = null;
            var pointer = textRange.Start as swd.TextPointer;

            if (pointer != null)
            {
                var                 needsContinue = true;
                swd.TextElement     text          = null;
                sw.DependencyObject element       = pointer.Parent as swd.TextElement;
                while (needsContinue && (element is swd.Inline || element is swd.Paragraph || element is swc.TextBlock))
                {
                    value = element.GetValue(formattingProperty);
                    text  = element as swd.TextElement;
                    var seq = value as IEnumerable;
                    needsContinue = (seq == null) ? value == null : seq.Cast <object>().Count() == 0;
                    element       = element is swd.TextElement ? ((swd.TextElement)element).Parent : null;
                }
                if (text != null)
                {
                    fullRange = new swd.TextRange(text.ElementStart, text.ElementEnd);
                }
            }
            return(value);
        }
        static CornerRadiusAnimation()
        {
            Type typeofProp = typeof(CornerRadius?);
            Type typeofThis = typeof(CornerRadiusAnimation);
            PropertyChangedCallback propCallback = new PropertyChangedCallback(AnimationFunction_Changed);
            ValidateValueCallback validateCallback = new ValidateValueCallback(ValidateFromToOrByValue);

            FromProperty = DependencyProperty.Register(
                "From",
                typeofProp,
                typeofThis,
                new PropertyMetadata((CornerRadius?)null, propCallback),
                validateCallback);

            ToProperty = DependencyProperty.Register(
                "To",
                typeofProp,
                typeofThis,
                new PropertyMetadata((CornerRadius?)null, propCallback),
                validateCallback);

            ByProperty = DependencyProperty.Register(
                "By",
                typeofProp,
                typeofThis,
                new PropertyMetadata((CornerRadius?)null, propCallback),
                validateCallback);
        }
 public static object CoerceKeyTip(ISyncKeyTipAndContent syncElement,
     object baseValue,
     DependencyProperty contentProperty)
 {
     DependencyObject element = syncElement as DependencyObject;
     Debug.Assert(element != null);
     if (syncElement.KeepKeyTipAndContentInSync &&
         !syncElement.IsKeyTipSyncSource)
     {
         syncElement.KeepKeyTipAndContentInSync = false;
         if (string.IsNullOrEmpty((string)baseValue))
         {
             string stringContent = element.GetValue(contentProperty) as string;
             if (stringContent != null)
             {
                 int accessIndex = RibbonHelper.FindAccessKeyMarker(stringContent);
                 if (accessIndex >= 0 && accessIndex < stringContent.Length - 1)
                 {
                     syncElement.KeepKeyTipAndContentInSync = true;
                     return StringInfo.GetNextTextElement(stringContent, accessIndex + 1);
                 }
             }
         }
     }
     return baseValue;
 }
Example #28
0
        static ZoomBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomBox), new FrameworkPropertyMetadata(typeof(ZoomBox)));

            ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(string), typeof(ZoomBox), new FrameworkPropertyMetadata());
            ZoomProperty = DependencyProperty.Register("Zoom", typeof(Double), typeof(ZoomBox), new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.None, ZoomPropertyChangedCallback));
        }
        public CategorySelectionStop(CiderCategoryContainer parent, bool isAdvanced) 
        {

            if (parent == null) 
            {
                throw FxTrace.Exception.ArgumentNull("parent");
            }
            if (parent.Category == null) 
            {
                throw FxTrace.Exception.ArgumentNull("parent.Category");
            }

            _parent = parent;
            _expansionProperty = isAdvanced ? Blend.CategoryContainer.AdvancedSectionPinnedProperty : Blend.CategoryContainer.ExpandedProperty;
            _selectionPath = CategoryContainerSelectionPathInterpreter.Instance.ConstructSelectionPath(parent.Category.CategoryName, isAdvanced);
            _description = isAdvanced ?
                string.Format(
                CultureInfo.CurrentCulture,
                System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_SelectionStatus_AdvancedCategory,
                parent.Category.CategoryName) :
                string.Format(
                CultureInfo.CurrentCulture,
                System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_SelectionStatus_Category,
                parent.Category.CategoryName);
        }
        public static Task SmoothSetAsync(this FrameworkElement @this, DependencyProperty dp, double targetvalue,
            TimeSpan iDuration, CancellationToken iCancellationToken)
        {
            TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
            DoubleAnimation anim = new DoubleAnimation(targetvalue, new Duration(iDuration));
            PropertyPath p = new PropertyPath("(0)", dp);
            Storyboard.SetTargetProperty(anim, p);
            Storyboard sb = new Storyboard();
            sb.Children.Add(anim);
            EventHandler handler = null;
            handler = delegate
            {
                sb.Completed -= handler;
                sb.Remove(@this);
                @this.SetValue(dp, targetvalue);
                tcs.TrySetResult(null);
            };
            sb.Completed += handler;
            sb.Begin(@this, true);

            iCancellationToken.Register(() =>
            {
                double v = (double)@this.GetValue(dp);  
                sb.Stop(); 
                sb.Remove(@this); 
                @this.SetValue(dp, v);
                tcs.TrySetCanceled();
            });

            return tcs.Task;
        }
 internal TemplateBindingExpression(DependencyObject source, TemplateBindingExtension binding, bool runtimeCheck)
 {
     this.Source = source;
     this.sourceProperty = binding.Property;
     this.bindingExtension = binding;
     this.runtimeCheck = runtimeCheck;
 }
 internal void SourcePropertyChanged(object sender, DependencyProperty dp)
 {
     if (dp == this.sourceProperty)
     {
         this.target.RefreshExpression(this.targetProperty);
     }
 }
        static DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression()
        {
            StringProperty =
                DependencyProperty.Register("String", typeof(string), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression));

            DoubleProperty =
                DependencyProperty.Register("Double", typeof(double), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata());

            FloatProperty =
                DependencyProperty.Register("Float", typeof(float), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata(default(float)));

            IntProperty =
                DependencyProperty.Register("Int", typeof(int), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata(default(int), OnDependencyPropertyChanged));

            BooleanProperty =
                DependencyProperty.Register("Boolean", typeof(bool), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata(default(bool), OnDependencyPropertyChanged, CoerceValueCallback));

            OtherStringProperty =
                Register("OtherString", typeof(string), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression));

            OtherDoubleProperty =
                Register("OtherDouble", typeof(double), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                         new PropertyMetadata());

            OtherFloatProperty =
                Register("OtherFloat", typeof(float), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                         new PropertyMetadata(default(float)));

            OtherIntProperty =
                Register("OtherInt", typeof(int), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                         new PropertyMetadata(default(int), OnDependencyPropertyChanged));

            OtherBooleanProperty =
                Register("OtherBoolean", typeof(bool), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                         new PropertyMetadata(default(bool), OnDependencyPropertyChanged, CoerceValueCallback));

            MoreStringProperty =
                DependencyProperty.Register("MoreString", typeof(string), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression));

            MoreDoubleProperty =
                DependencyProperty.Register("MoreDouble", typeof(double), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata());

            MoreFloatProperty =
                DependencyProperty.Register("MoreFloat", typeof(float), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata(default(float)));

            MoreIntProperty =
                DependencyProperty.Register("MoreInt", typeof(int), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata(default(int), OnDependencyPropertyChanged));

            MoreBooleanProperty =
                DependencyProperty.Register("MoreBoolean", typeof(bool), typeof(DependencyPropertyDeclarationsInConstructorThatAreCandidatesToUseNameofExpression),
                                            new PropertyMetadata(default(bool), OnDependencyPropertyChanged, CoerceValueCallback));
        }
 static StringTemplateEditor()
 {
     SuggestionsKeyProperty = System.Windows.DependencyProperty.Register(
         "SuggestionsKey",
         typeof(string),
         typeof(StringTemplateEditor),
         new FrameworkPropertyMetadata(OnSuggestionsKeyChanged)
         );
 }
        static ReportField()
        {
            // ColumnId Property
            ReportField.ColumnIdProperty = DependencyProperty.Register("ColumnId", typeof(String), typeof(ReportField));

            // Width Property
            ReportField.WidthProperty = DependencyProperty.Register("Width", typeof(System.Double), typeof(ReportField),
                                                                    new PropertyMetadata(new PropertyChangedCallback(OnWidthChanged)));
        }
        /// <summary>
        /// Creates the static resources used by this class.
        /// </summary>
        static RowHeaderCanvas()
        {
            // This value is used to prevent modifications to the colum header.  Once frozen, selecting a part of the header will
            // select the entire row.  When not frozen, dragging rows around will change the order and size of the rows.
            RowHeaderCanvas.IsHeaderFrozenProperty = DependencyProperty.Register("IsHeaderFrozen", typeof(object),
                                                                                 typeof(RowHeaderCanvas), new FrameworkPropertyMetadata(true));

            // Select Row Command
            RowHeaderCanvas.FreezeRowHeaders = new RoutedUICommand("FreezeRowHeaders", "Freeze Row Headers", typeof(RowHeaderCanvas));
        }
Example #37
0
        public static PropertyChangeNotifier Register(sw.DependencyProperty property, EventHandler handler, sw.DependencyObject propertySource = null)
        {
            var notifier = new PropertyChangeNotifier(property);

            if (propertySource != null)
            {
                notifier.PropertySource = propertySource;
            }
            notifier.ValueChanged += handler;
            return(notifier);
        }
Example #38
0
        public DependencyPropertySubscription(T element, DependencyProperty dependencyProperty)
        {
            this.Element            = element;
            this.DependencyProperty = dependencyProperty;

            var sourceBinding = new System.Windows.Data.Binding("Value")
            {
                Source = this, Mode = BindingMode.TwoWay
            };

            element.SetBinding(this.DependencyProperty, sourceBinding);
        }
 public ColumnChangedEventArgs(RoutedEvent routedEvent, UndoAction undoAction,
                               ReportColumn reportColumn, DependencyProperty dependencyProperty,
                               object oldValue, object newValue)
     : base(routedEvent)
 {
     // Initialize the object.
     this.UndoAction         = undoAction;
     this.ColumnDefinition   = reportColumn;
     this.DependencyProperty = dependencyProperty;
     this.OldValue           = oldValue;
     this.NewValue           = newValue;
 }
Example #40
0
            internal void SetActive(bool active)
            {
                if (_isInitializing)
                {
                    afterInit = () => SetActive(active);
                    return;
                }
                if (Storyboard != null)
                {
                    if (active)
                    {
                        Storyboard.Begin();
                    }
                    else
                    {
                        Storyboard.Stop();
                    }
                }

                //var storyboard = new System.Windows.Media.Animation.Storyboard();
                foreach (var setter in _setters.OfType <System.Windows.Setter>())
                {
                    System.Windows.DependencyProperty property = setter.Property;
                    object value      = setter.Value;                //Why doesn't this  return the actual value???
                    string targetName = setter.TargetName;

                    //var s = new System.Windows.Media.Animation.DoubleAnimation() { };
                    //System.Windows.Media.Animation.Storyboard.SetTargetName(s, setter.TargetName);
                    //System.Windows.Media.Animation.Storyboard.SetTargetProperty(s, new System.Windows.PropertyPath(string.Format("({0}.{1})", setter.Property.OwnerType.Name, setter.Property.Name )));
                    //s.To = (double)setter.Value;
                    //storyboard.Children.Add(s);

                    //This isn't really working... need a better way
                    //if (System.Windows.Application.Current.MainWindow != null)
                    //{
                    //	if (System.Windows.Application.Current.MainWindow.IsLoaded)
                    //	{
                    //		var target = System.Windows.Application.Current.MainWindow.FindName(targetName) as System.Windows.DependencyObject;
                    //		if (target != null)
                    //			target.SetValue(property, value);
                    //	}
                    //	else
                    //		System.Windows.Application.Current.MainWindow.Loaded += (s, e) =>
                    //		{
                    //			var target = System.Windows.Application.Current.MainWindow.FindName(targetName) as System.Windows.DependencyObject;
                    //			if (target != null)
                    //				target.SetValue(property, value);
                    //		};
                    //}
                }
                //storyboard.Begin()
            }
Example #41
0
        // Thay đổi 1 loại thuộc tính dp cho văn bản đang chọn
        public void changePropertyText(System.Windows.DependencyProperty dp, object value)
        {
            if (rtbox != null)
            {
                TextSelection textSelection = rtbox.Selection;

                if (!textSelection.IsEmpty)
                {
                    textSelection.ApplyPropertyValue(dp, value);
                    rtbox.Focus();
                }
            }
        }
Example #42
0
        /// <summary>
        /// Create the static resources for the ItemSelector.
        /// </summary>
        static ItemSelector()
        {
            // ItemsSource Property
            ItemSelector.ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable),
                                                                           typeof(ItemSelector));

            // SelectedValue Property
            ItemSelector.SelectedValueProperty = DependencyProperty.Register("SelectedValue", typeof(Object), typeof(ItemSelector),
                                                                             new FrameworkPropertyMetadata(OnSelectedValueChanged));

            // SelectedValuePath Property
            ItemSelector.SelectedValuePathProperty = DependencyProperty.Register("SelectedValuePath", typeof(String),
                                                                                 typeof(ItemSelector));
        }
Example #43
0
        void SetSelectionAttribute(sw.DependencyProperty property, object value)
        {
            selectionAttributes = selectionAttributes ?? new Dictionary <sw.DependencyProperty, object>();
            if (value == null)
            {
                if (selectionAttributes.ContainsKey(property))
                {
                    selectionAttributes.Remove(property);
                }
            }
            else
            {
                selectionAttributes[property] = value;
            }

            Control.Selection.ApplyPropertyValue(property, value);
        }
Example #44
0
        // Existing GetPropertyValue for the TextDecorationCollection will return the first collection, even if it is empty.
        // this skips empty collections so we can get the actual value.
        // slightly modified code from https://social.msdn.microsoft.com/Forums/vstudio/en-US/3ac626cf-60aa-427f-80e9-794f3775a70e/how-to-tell-if-richtextbox-selection-is-underlined?forum=wpf
        object GetPropertyValue(swd.TextRange textRange, sw.DependencyProperty formattingProperty)
        {
            object value   = null;
            var    pointer = textRange.Start as swd.TextPointer;

            if (pointer != null)
            {
                var needsContinue           = true;
                sw.DependencyObject element = pointer.Parent as swd.TextElement;
                while (needsContinue && (element is swd.Inline || element is swd.Paragraph || element is swc.TextBlock))
                {
                    value = element.GetValue(formattingProperty);
                    var seq = value as IEnumerable;
                    needsContinue = (seq == null) ? value == null : seq.Cast <Object>().Count() == 0;
                    element       = element is swd.TextElement ? ((swd.TextElement)element).Parent : null;
                }
            }
            return(value);
        }
Example #45
0
        static AnimatedImage()
        {
            AnimatedImage.CurrentFrameProperty = DependencyProperty.Register(
                "CurrentFrame",
                typeof(ImageSource),
                typeof(AnimatedImage)
                );
            AnimatedImage.StretchDirectionProperty = DependencyProperty.Register(
                "StretchDirection",
                typeof(StretchDirection),
                typeof(AnimatedImage)
                );
            AnimatedImage.StretchProperty = DependencyProperty.Register(
                "Stretch",
                typeof(Stretch),
                typeof(AnimatedImage)
                );

            FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(AnimatedImage), new FrameworkPropertyMetadata(typeof(AnimatedImage)));
        }
Example #46
0
        /// <summary>
        /// Initializes the static elements of the document viewer.
        /// </summary>
        static DynamicReport()
        {
            // These namespaces prevent name conflicts by qualifying the XAML values used in the source code for this report.
            DynamicReport.namespaceXaml         = "http://schemas.microsoft.com/winfx/2006/xaml";
            DynamicReport.namespacePresentation = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
            DynamicReport.xNameReport           = DynamicReport.namespacePresentation + "DynamicReport";

            // Cell
            DynamicReport.CellProperty = DependencyProperty.RegisterAttached("Cell", typeof(ReportCell), typeof(DynamicReport));

            // Content
            DynamicReport.ContentProperty = DependencyProperty.Register(
                "Content",
                typeof(IContent),
                typeof(DynamicReport),
                new FrameworkPropertyMetadata(new PropertyChangedCallback(OnContentChanged)));

            // IsActive
            DynamicReport.IsActiveProperty = DependencyProperty.RegisterAttached(
                "IsActive",
                typeof(Boolean),
                typeof(DynamicReport),
                new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits));

            // IsEven
            DynamicReport.IsEvenProperty = DependencyProperty.RegisterAttached("IsEven", typeof(Boolean), typeof(DynamicReport), new PropertyMetadata(false));

            // IsSelected
            DynamicReport.IsSelectedProperty = DependencyProperty.RegisterAttached("IsSelected", typeof(Boolean), typeof(DynamicReport), new PropertyMetadata(false));

            // IsPopup
            DynamicReport.IsPopupProperty = DependencyProperty.RegisterAttached("IsPopup", typeof(Boolean), typeof(DynamicReport), new PropertyMetadata(false));

            // IsLayoutFrozen
            DynamicReport.IsLayoutFrozenProperty = DependencyProperty.Register(
                "IsLayoutFrozen",
                typeof(Object),
                typeof(DynamicReport),
                new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsArrange, new PropertyChangedCallback(OnIsLayoutFrozenChanged)));

            // IsHeaderFrozen
            DynamicReport.IsHeaderFrozenProperty = DependencyProperty.Register(
                "IsHeaderFrozen",
                typeof(Boolean),
                typeof(DynamicReport),
                new PropertyMetadata(true, new PropertyChangedCallback(OnIsHeaderFrozenChanged)));

            // Scale
            DynamicReport.ScaleProperty = DependencyProperty.Register("Scale",
                                                                      typeof(Double),
                                                                      typeof(DynamicReport),
                                                                      new FrameworkPropertyMetadata(1.0, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnScaleChanged)));

            // Source
            DynamicReport.SourceProperty = DependencyProperty.Register("Source", typeof(XDocument), typeof(DynamicReport), new FrameworkPropertyMetadata(OnSourceChanged));

            // The Split property determines where the row and column headers are positioned.
            DynamicReport.SplitProperty = DependencyProperty.Register("Split",
                                                                      typeof(Size),
                                                                      typeof(DynamicReport),
                                                                      new FrameworkPropertyMetadata(new Size(), FrameworkPropertyMetadataOptions.AffectsMeasure, new PropertyChangedCallback(OnSplitChanged)));

            // UndoPropertyChanged
            DynamicReport.UndoPropertyChangedEvent = EventManager.RegisterRoutedEvent("UndoPropertyChanged", RoutingStrategy.Bubble, typeof(UndoPropertyChangedEventHandler), typeof(DynamicReport));

            // ClearContents
            DynamicReport.ClearContents = new RoutedUICommand("Clear Contents", "ClearContents", typeof(DynamicReport));

            // Select Column
            DynamicReport.SelectColumn = new RoutedUICommand("Select", "SelectColumn", typeof(DynamicReport));

            // SetIsLayoutFrozen
            DynamicReport.SetIsLayoutFrozen = new RoutedUICommand("Is Layout Frozen", "SetIsLayoutFrozen", typeof(DynamicReport));

            //openReports = new Dictionary<Guid, DateTime>();
        }
Example #47
0
 public static T GetValueThreadSafe <T>(this System.Windows.DependencyObject obj, System.Windows.DependencyProperty p)
 {
     return((T)obj.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background,
                                     (System.Windows.Threading.DispatcherOperationCallback) delegate
     {
         return obj.GetValue(p);
     }, p));
 }
Example #48
0
 static BitmapString()
 {
     BitmapString.SourceProperty = DependencyProperty.Register("Source", typeof(string), typeof(BitmapString),
                                                               new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.None, new PropertyChangedCallback(OnSourceChanged)));
 }
 internal void InvokeMerge(PropertyMetadata baseMetadata, DependencyProperty dp)
 {
     Merge(baseMetadata, dp);
 }
Example #50
0
 public PropertyChangeNotifier(sw.DependencyProperty property)
     : this(new sw.PropertyPath(property))
 {
 }
 public static DependencyPropertyReferenceStep GetReferenceStep(ITypeResolver typeResolver, Type targetType, System.Windows.DependencyProperty dependencyProperty, Microsoft.Expression.DesignModel.Metadata.MemberType memberTypes)
 {
     return(DependencyPropertyReferenceStep.GetReferenceStep(typeResolver, targetType, dependencyProperty, dependencyProperty.OwnerType, dependencyProperty.Name, Microsoft.Expression.DesignModel.Metadata.MemberType.Property));
 }
        [FriendAccessAllowed] // Built into Base, also used by Framework.
        internal object GetDefaultValue(DependencyObject owner, DependencyProperty property)
        {
            Debug.Assert(owner != null && property != null,
                         "Caller must provide owner and property or this method will throw in the event of a cache miss.");

            // If we are not using a DefaultValueFactory (common case)
            // just return _defaultValue
            DefaultValueFactory defaultFactory = _defaultValue as DefaultValueFactory;

            if (defaultFactory == null)
            {
                return(_defaultValue);
            }

            // If the owner is Sealed it must not have a cached Freezable default value,
            // regardless of whether or not the owner is a Freezable.  The reason
            // for this is that a default created using the FreezableDefaultValueFactory
            // will attempt to set itself as a local value if it is changed.  Since the owner
            // is Sealed this will throw an exception.
            //
            // The solution to this if the owner is a Freezable is to toss out all cached
            // default values when we Seal.  If the owner is not a Freezable we'll promote
            // the value to locally cached.  Either way no Sealed DO can have a cached
            // default value, so we'll return the frozen default value instead.
            if (owner.IsSealed)
            {
                return(defaultFactory.DefaultValue);
            }

            // See if we already have a valid default value that was
            // created by a prior call to GetDefaultValue.
            object result = GetCachedDefaultValue(owner, property);

            if (result != DependencyProperty.UnsetValue)
            {
                // When sealing a DO we toss out all the cached values (see DependencyObject.Seal()).
                // We technically only need to throw out cached values created via the
                // FreezableDefaultValueFactory, but it's more consistent this way.
                Debug.Assert(!owner.IsSealed,
                             "If the owner is Sealed we should not have a cached default value");

                return(result);
            }

            // Otherwise we need to invoke the factory to create the DefaultValue
            // for this property.
            result = defaultFactory.CreateDefaultValue(owner, property);

            // Default value validation ensures that default values do not have
            // thread affinity. This is because a default value is typically
            // stored in the shared property metadata and handed out to all
            // instances of the owning DependencyObject type.
            //
            // DefaultValueFactory.CreateDefaultValue ensures that the default
            // value has thread-affinity to the current thread.  We can thus
            // skip that portion of the default value validation by calling
            // ValidateFactoryDefaultValue.

            Debug.Assert(!(result is DispatcherObject) || ((DispatcherObject)result).Dispatcher == owner.Dispatcher);

            property.ValidateFactoryDefaultValue(result);

            // Cache the created DefaultValue so that we can consistently hand
            // out the same default each time we are asked.
            SetCachedDefaultValue(owner, property, result);

            return(result);
        }
Example #53
0
        public static void LoadAndMonitor(INotifyPropertyChanged source, string sourceProperty, System.Windows.Controls.Control control, System.Windows.DependencyProperty controlProperty = null)
        {
            if (controlProperty == null)
            {
                if (control is System.Windows.Controls.TextBox)
                {
                    controlProperty = System.Windows.Controls.TextBox.TextProperty;
                }
                if (control is System.Windows.Controls.CheckBox)
                {
                    controlProperty = System.Windows.Controls.Primitives.ToggleButton.IsCheckedProperty;
                }
                if (control is System.Windows.Controls.ComboBox || control is System.Windows.Controls.ListBox)
                {
                    controlProperty = System.Windows.Controls.Primitives.Selector.SelectedValueProperty;
                }
            }
            var binding = new System.Windows.Data.Binding(sourceProperty);

            binding.Source  = source;
            binding.IsAsync = true;
            control.SetBinding(controlProperty, binding);
        }
Example #54
0
 public static void SetValueThreadSafe(this System.Windows.DependencyObject obj, System.Windows.DependencyProperty p, object value)
 {
     obj.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background,
                                (System.Threading.SendOrPostCallback) delegate
     {
         obj.SetValue(p, value);
     }, value);
 }
        private static bool DefaultFreezeValueCallback(
            DependencyObject d,
            DependencyProperty dp,
            EntryIndex entryIndex,
            PropertyMetadata metadata,
            bool isChecking)
        {
            // The expression check only needs to be done when isChecking is true
            // because if we return false here the Freeze() call will fail.
            if (isChecking)
            {
                if (d.HasExpression(entryIndex, dp))
                {
                    if (TraceFreezable.IsEnabled)
                    {
                        TraceFreezable.Trace(
                            TraceEventType.Warning,
                            TraceFreezable.UnableToFreezeExpression,
                            d,
                            dp,
                            dp.OwnerType);
                    }

                    return(false);
                }
            }

            if (!dp.IsValueType)
            {
                object value =
                    d.GetValueEntry(
                        entryIndex,
                        dp,
                        metadata,
                        RequestFlags.FullyResolved).Value;

                if (value != null)
                {
                    Freezable valueAsFreezable = value as Freezable;

                    if (valueAsFreezable != null)
                    {
                        if (!valueAsFreezable.Freeze(isChecking))
                        {
                            if (TraceFreezable.IsEnabled)
                            {
                                TraceFreezable.Trace(
                                    TraceEventType.Warning,
                                    TraceFreezable.UnableToFreezeFreezableSubProperty,
                                    d,
                                    dp,
                                    dp.OwnerType);
                            }

                            return(false);
                        }
                    }
                    else  // not a Freezable
                    {
                        DispatcherObject valueAsDispatcherObject = value as DispatcherObject;

                        if (valueAsDispatcherObject != null)
                        {
                            if (valueAsDispatcherObject.Dispatcher == null)
                            {
                                // The property is a free-threaded DispatcherObject; since it's
                                // already free-threaded it doesn't prevent this Freezable from
                                // becoming free-threaded too.
                                // It is up to the creator of this type to ensure that the
                                // DispatcherObject is actually immutable
                            }
                            else
                            {
                                // The value of this property derives from DispatcherObject and
                                // has thread affinity; return false.

                                if (TraceFreezable.IsEnabled)
                                {
                                    TraceFreezable.Trace(
                                        TraceEventType.Warning,
                                        TraceFreezable.UnableToFreezeDispatcherObjectWithThreadAffinity,
                                        d,
                                        dp,
                                        dp.OwnerType,
                                        valueAsDispatcherObject);
                                }

                                return(false);
                            }
                        }

                        // The property isn't a DispatcherObject.  It may be immutable (such as a string)
                        // or the user may have made it thread-safe.  It's up to the creator of the type to
                        // do the right thing; we return true as an extensibility point.
                    }
                }
            }

            return(true);
        }
Example #56
0
 public object GetAnimationBaseValue(DependencyProperty dp)
 {
     throw new NotImplementedException();
 }
Example #57
0
 public virtual void ApplyAnimationClock(DependencyProperty dp, AnimationClock clock, HandoffBehavior handoffBehavior)
 {
     throw new NotImplementedException();
 }
 public Setter(DependencyProperty property, Object value, string targetName)
 {
     Contract.Ensures(!property.ReadOnly);
 }
 /// <summary>
 ///     Notification that this metadata has been applied to a property
 ///     and the metadata is being sealed
 /// </summary>
 /// <remarks>
 ///     Normally, any mutability of the data structure should be marked
 ///     as immutable at this point
 /// </remarks>
 /// <param name="dp">DependencyProperty</param>
 /// <param name="targetType">Type associating metadata (null if default metadata)</param>
 protected virtual void OnApply(DependencyProperty dp, Type targetType)
 {
 }
Example #60
0
 public virtual void BeginAnimation(DependencyProperty dp, AnimationTimeline animation)
 {
     throw new NotImplementedException();
 }