Exemplo n.º 1
0
        private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            _currentRoot?.ClearValue(IsTiltingProperty);

            TiltDownStoryboard?.Stop(_target);
            TiltUpStoryboard?.Begin(_target);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Removes the specified view from the region.
        /// </summary>
        /// <param name="view">The view to remove.</param>
        public virtual void Remove(object view)
        {
            ItemMetadata itemMetadata = this.GetItemMetadataOrThrow(view);

            this.ItemMetadataCollection.Remove(itemMetadata);

            DependencyObject dependencyObject = view as DependencyObject;

            if (dependencyObject != null && Regions.RegionManager.GetRegionManager(dependencyObject) == this.RegionManager)
            {
                dependencyObject.ClearValue(Regions.RegionManager.RegionManagerProperty);
            }
        }
Exemplo n.º 3
0
        private void SetTextFontSize(DependencyObject textElement, DependencyProperty fontSizeProperty)
        {
            double newFontSize = this.FontSize;

            if (double.IsNaN(newFontSize))
            {
                textElement.ClearValue(fontSizeProperty);
            }
            else
            {
                textElement.SetValue(fontSizeProperty, newFontSize);
            }
        }
Exemplo n.º 4
0
        public static object UpdateDependencyColor(this DependencyObject depo, DependencyProperty dp, Color newColor)
        {
            if (!newColor.IsDefault)
            {
                depo.SetValue(dp, newColor.ToBrush());
            }
            else
            {
                depo.ClearValue(dp);
            }

            return(depo.GetValue(dp));
        }
 /// <summary>
 /// Synchronizes the column property. Taken from Helper code for DataGrid.
 /// </summary>
 internal static bool SyncColumnProperty(DependencyObject column, DependencyObject content, DependencyProperty columnProperty, DependencyProperty contentProperty)
 {
     if (IsDefaultValue(column, columnProperty))
     {
         content.ClearValue(contentProperty);
         return(false);
     }
     else
     {
         content.SetValue(contentProperty, column.GetValue(columnProperty));
         return(true);
     }
 }
Exemplo n.º 6
0
        private void UpdateBehavior(DependencyObject host, IBehavior behavior)
        {
            if (behavior.IsApplicable())
            {
                behavior.Update();
            }
            else
            {
                host.ClearValue(_property);

                behavior.Detach();
            }
        }
        private void UpdateBehavior(DependencyObject host, IBehavior behavior, DependencyPropertyChangedEventArgs propertyChangedEventArgs)
        {
            if (behavior.IsApplicable())
            {
                behavior.Update(propertyChangedEventArgs);
            }
            else
            {
                host.ClearValue(_property);

                behavior.Detach();
            }
        }
Exemplo n.º 8
0
            private static void Clear(
                DependencyObject target,
                DependencyProperty targetDP,
                DependencyObject source,
                DependencyProperty sourceDP)
            {
                var binding = BindingOperations.GetBinding(target, targetDP);

                if (binding != null && binding.Source == source)
                {
                    target.ClearValue(targetDP);
                }
            }
Exemplo n.º 9
0
        // Update HasErrors and Invalidate the public ValidationErrors property whose GetOverride will return
        // the updated value of ValidationErrorsInternal, nicely wrapped into a ReadOnlyCollection<T>
        private static void OnErrorsInternalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ValidationErrorCollection newErrors = e.NewValue as ValidationErrorCollection;

            if (newErrors != null)
            {
                d.SetValue(ErrorsProperty, new ReadOnlyObservableCollection <ValidationError>(newErrors));
            }
            else
            {
                d.ClearValue(ErrorsProperty);
            }
        }
Exemplo n.º 10
0
        public static void ClearExpandoValue(this DependencyObject depObj, string propertyName, object value, bool skipPropertyChangedHandler)
        {
            var prop = DependencyPropertyManager.GetExpandoProperty(propertyName);

            if (skipPropertyChangedHandler == false)
            {
                depObj.ClearValue(prop);

                return;
            }

            try
            {
                depObj.SuspendPropertyChangedCallback(prop);

                depObj.ClearValue(prop);
            }
            finally
            {
                depObj.ResumePropertyChangedCallback(prop);
            }
        }
Exemplo n.º 11
0
    private static void OnToolTipChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        // clean up any old tooltip value
        if (null != e.OldValue)
        {
            var oldTT = d.GetValue(ToolTipService.ToolTipProperty) as ToolTip;

            // detach our tooltip value from the object
            d.ClearValue(ToolTipService.ToolTipProperty);

            if (null != oldTT)
            {
                NameScope.SetNameScope(oldTT, null);

                if (oldTT.Tag == AutoGeneratedId)
                {
                    oldTT.Content = null;
                }

                oldTT.Initialized -= NewTTInitialized;
            }
        }

        // if we're getting a new tooltip then initialize the tooltip
        // property of the associated object
        if (null == e.NewValue)
        {
            return;
        }
        var newTT = e.NewValue as ToolTip ?? new ToolTip {
            Tag = AutoGeneratedId, Content = e.NewValue
        };

        // if the value isn't a tooltip then create one around it
        // so we can bind the datacontext and provide a namescope

        d.SetValue(ToolTipService.ToolTipProperty, newTT);

        // provide a temporary namescope so we can handle any element name bindings
        NameScope.SetNameScope(newTT, new NameScopeHelper(d));

        // during the BamlRecordReader's PushContext, the tooltip didn't have
        // a namescope so we need to make sure we remove the namescope before
        // the PopContext or else the reader will try to push too much off
        // the stack and an exception will occur. the Initialized event of
        // the associated element is sufficient to do this. an alternative
        // approach would be to use a custom tooltip that implements INameScope
        // so that the tooltip always has a namescope at the Push and PopContext
        // points.
        newTT.Initialized += NewTTInitialized;
    }
        /// <summary>
        /// Transfer any binding from the source DP to the given target's DP.
        /// </summary>
        /// <param name="source">Source element.</param>
        /// <param name="path"></param>
        /// <param name="target">Target framework element.</param>
        /// <param name="dp"></param>
        public static void ApplyBinding(FrameworkElement source, String path, DependencyObject target, DependencyProperty dp)
        {
            var bx = source.GetBindingExpression(dp);

            if (bx != null)
            {
                target.ClearValue(dp);
                BindingOperations.SetBinding(target, dp, bx.ParentBinding);
            }
            else
            {
                BindTo(source, path, target, dp);
            }
        }
Exemplo n.º 13
0
 private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue)
     {
         var element  = (ItemsControl)d;
         var behavior = new ListItemMoveBehavior(element);
         SetBehavior(element, behavior);
     }
     else
     {
         GetBehavior(d).Dispose();
         d.ClearValue(BehaviorProperty);
     }
 }
Exemplo n.º 14
0
 private static void OnScopeForChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (((InputTypeCollection)e.NewValue)?.IsInputType(d) == true)
     {
         if (GetErrors(d) == null)
         {
             SetErrors(d, ErrorNode.CreateFor(d));
         }
     }
     else if (((InputTypeCollection)e.OldValue)?.IsInputType(d) == true)
     {
         d.ClearValue(ErrorsPropertyKey);
     }
 }
Exemplo n.º 15
0
        public static void EnsureBindingAttached(DependencyObject dependencyObject, DependencyProperty dependencyProperty)
        {
            if (!(dependencyObject.ReadLocalValue(dependencyProperty) is BindingExpression bindingExpression))
            {
                return;
            }

            // Rebind to actual DataContext
            if (bindingExpression.Status == BindingStatus.Unattached)
            {
                dependencyObject.ClearValue(dependencyProperty);
                dependencyObject.SetBinding(dependencyProperty, bindingExpression.ParentBinding);
            }
        }
Exemplo n.º 16
0
 private static void ClearChildViews(IRegion region)
 {
     foreach (var view in region.Views)
     {
         DependencyObject dependencyObject = view as DependencyObject;
         if (dependencyObject != null)
         {
             if (GetClearChildViews(dependencyObject))
             {
                 dependencyObject.ClearValue(RegionManager.RegionManagerProperty);
             }
         }
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// Clear the bindings created when the overlay was created by MapChild
        /// </summary>
        /// <param name="mapOverlay">MapOverlay that was created by MapChild</param>
        /// <param name="targetObject">Target object to be used to clear the bindings</param>
        internal static void ClearMapOverlayBindings(MapOverlay mapOverlay, DependencyObject targetObject)
        {
            GeoCoordinate geoCoordinate;
            Point         point;

            // Clear happens always in the target object.
            // Binding was created with MapOverlay been the source.
            // See code that creates the binding for more info.
            Debug.Assert((bool)mapOverlay.GetValue(MapChild.ToolkitCreatedProperty), "expected that we only get this calls for overlays created by the toolkit");

            // It would be weird that bindings are cleared and out of the sudden the object from the client
            // looses the values he once provided.
            // They are lost because we setup the binding in a weird way. See code that creates the map overlay.
            // Save them to set them after clearing the binding
            geoCoordinate = (GeoCoordinate)targetObject.GetValue(MapChild.GeoCoordinateProperty);
            point         = (Point)targetObject.GetValue(MapChild.PositionOriginProperty);

            targetObject.ClearValue(MapChild.GeoCoordinateProperty);
            targetObject.ClearValue(MapChild.PositionOriginProperty);

            targetObject.SetValue(MapChild.GeoCoordinateProperty, geoCoordinate);
            targetObject.SetValue(MapChild.PositionOriginProperty, point);
        }
        public void ResetValue(DependencyObject _this, DependencyProperty dp)
        {
            var md = dp.GetMetadata(_this.GetType());

            if (_this.GetValue(dp).Equals(md.DefaultValue))
            {
                var args = new DependencyPropertyChangedEventArgs(dp, DependencyProperty.UnsetValue, md.DefaultValue);
                md.PropertyChangedCallback?.Invoke(_this, args);
            }
            else
            {
                _this.ClearValue(dp);
            }
        }
 /// <summary>Removes the binding from a property if there is one.</summary>
 /// <param name="target">The object from which to remove the binding.</param>
 /// <param name="dp">The dependency property from which to remove the binding.</param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="target" /> and <paramref name="dp" /> parameters cannot be <see langword="null" />.</exception>
 // Token: 0x06001A33 RID: 6707 RVA: 0x0007D1AC File Offset: 0x0007B3AC
 public static void ClearBinding(DependencyObject target, DependencyProperty dp)
 {
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     if (dp == null)
     {
         throw new ArgumentNullException("dp");
     }
     if (BindingOperations.IsDataBound(target, dp))
     {
         target.ClearValue(dp);
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// <see cref="PropertyMetadata.PropertyChangedCallback"/>
        /// </summary>
        /// <remarks>
        /// This method reflects Grid.SharedScopeProperty state by setting / clearing
        /// dynamic property PrivateSharedSizeScopeProperty. Value of PrivateSharedSizeScopeProperty
        /// is a collection of SharedSizeState objects for the scope.
        /// Also PrivateSharedSizeScopeProperty is FrameworkPropertyMetadataOptions.Inherits property. So that all children
        /// elements belonging to a certain scope can easily access SharedSizeState collection. As well
        /// as been norified about enter / exit a scope.
        /// </remarks>
        internal static void OnIsSharedSizeScopePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //


            if ((bool)e.NewValue)
            {
                SharedSizeScope sharedStatesCollection = new SharedSizeScope();
                d.SetValue(PrivateSharedSizeScopeProperty, sharedStatesCollection);
            }
            else
            {
                d.ClearValue(PrivateSharedSizeScopeProperty);
            }
        }
Exemplo n.º 21
0
 public static void RestoreLocalValue(this DependencyObject target, DependencyProperty dependencyProperty, object localValue)
 {
     if (localValue == DependencyProperty.UnsetValue)
     {
         target.ClearValue(dependencyProperty);
     }
     else if (localValue is BindingExpression localValueBindingExpression)
     {
         target.SetBinding(dependencyProperty, localValueBindingExpression.ParentBinding);
     }
     else
     {
         target.SetValue(dependencyProperty, localValue);
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// <see cref="PropertyMetadata.PropertyChangedCallback"/>
 /// </summary>
 /// <remarks>
 /// This method reflects Grid.SharedScopeProperty state by setting / clearing
 /// dynamic property PrivateSharedSizeScopeProperty. Value of PrivateSharedSizeScopeProperty
 /// is a collection of SharedSizeState objects for the scope.
 /// Also PrivateSharedSizeScopeProperty is FrameworkPropertyMetadataOptions.Inherits property. So that all children
 /// elements belonging to a certain scope can easily access SharedSizeState collection. As well
 /// as been norified about enter / exit a scope.
 /// </remarks>
 internal static void OnIsSharedSizeScopePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     //  is it possible to optimize here something like this:
     //  if ((bool)d.GetValue(Grid.IsSharedSizeScopeProperty) == (d.GetLocalValue(PrivateSharedSizeScopeProperty) != null)
     //  { /* do nothing */ }
     if ((bool)e.NewValue)
     {
         SharedSizeScope sharedStatesCollection = new SharedSizeScope();
         d.SetValue(PrivateSharedSizeScopeProperty, sharedStatesCollection);
     }
     else
     {
         d.ClearValue(PrivateSharedSizeScopeProperty);
     }
 }
        /// <summary>
        /// Moves dependency property value from a source to target, if exists.
        /// </summary>
        /// <param name="sourceObject">The source object.</param>
        /// <param name="targetObject">The target object.</param>
        /// <param name="property">The property to copy.</param>
        private static void MoveProperty(DependencyObject sourceObject, DependencyObject targetObject, DependencyProperty property)
        {
            // get value from source object
            object propertyValue = sourceObject.ReadLocalValue(property);

            // if property value exists
            if (propertyValue != DependencyProperty.UnsetValue)
            {
                // copy value on target object
                targetObject.SetValue(property, propertyValue);

                // remove value from source object
                sourceObject.ClearValue(property);
            }
        }
Exemplo n.º 24
0
        protected override void ApplyItemContainerStyle(DependencyObject container, object item)
        {
            var style = ContainerStyle;

            if (null == style && ContainerStyleSelector != null)
            {
                style = ContainerStyleSelector.SelectStyle(item, container);
            }

            if (null != style)
            {
                container.SetValue(AppliedStyleProperty, KnownBoxes.FalseBox);
                container.SetValue(FrameworkElement.StyleProperty, style);
            }
            else
            {
                if (true.Equals(container.GetValue(AppliedStyleProperty)))
                {
                    // if we don't get a style now but we applied one previously clear it
                    container.ClearValue(AppliedStyleProperty);
                    container.ClearValue(FrameworkElement.StyleProperty);
                }
            }
        }
        public static void SetIsPrimaryHandPointerOver(DependencyObject obj, bool value)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            if (!value)
            {
                obj.ClearValue(IsPrimaryHandPointerOverProperty);
            }
            else
            {
                obj.SetValue(IsPrimaryHandPointerOverProperty, true);
            }
        }
        public static void SetKinectRegion(DependencyObject obj, KinectRegion value)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            if (value == null)
            {
                obj.ClearValue(KinectRegionProperty);
            }
            else
            {
                obj.SetValue(KinectRegionProperty, value);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Invoked when the System.Windows.Media.VisualCollection of a visual object
        /// is modified.
        /// </summary>
        /// <param name="visualAdded">
        /// The System.Windows.Media.Visual that was added to the collection.
        /// </param>
        /// <param name="visualRemoved">
        ///     The System.Windows.Media.Visual that was removed from the collection.
        /// </param>
        protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
            if (visualRemoved == null)
            {
                return;
            }

            ItemAnimationData animationData = GetAnimationData(visualRemoved);

            if (animationData == null)
            {
                return;
            }

            visualRemoved.ClearValue(AnimationDataProperty);
        }
Exemplo n.º 28
0
        private static void HandleContextMenuOpeningStatic(object sender, ContextMenuEventArgs e)
        {
            DependencyObject dObjSender         = sender as DependencyObject;
            IInputElement    inputElementSender = sender as IInputElement;

            if (dObjSender != null && inputElementSender != null)
            {
                ContextMenu contextMenu = (ContextMenu)(dObjSender.GetValue(FrameworkElement.ContextMenuProperty));

                if (contextMenu == null)
                {
                    TextSelectionSettings         settings = TextSelection.GetSettings(dObjSender);
                    IEnumerable <RoutedUICommand> commands = null;

                    if (settings != null && settings.HasContextMenuCommands)
                    {
                        commands = settings.ContextMenuCommands;
                    }
                    else
                    {
                        commands = TextSelectionSettings.DefaultContextMenuCommands;
                    }

                    contextMenu = CreateContextMenu(inputElementSender, commands);

                    if (contextMenu != null)
                    {
                        // We are repacing a null ContextMenu with our built from scratch ContextMenu.
                        // Mark the event as handled so that the built in context menu service does not
                        // try to open the null Context menu and we can open our built from scratch menu
                        // ourselves
                        e.Handled = true;

                        RoutedEventHandler handleContextMenuClosed = null;
                        handleContextMenuClosed = (closedSender, closedArgs) =>
                        {
                            inputElementSender.RemoveHandler(FrameworkElement.ContextMenuClosingEvent, handleContextMenuClosed);
                            dObjSender.ClearValue(FrameworkElement.ContextMenuProperty);
                        };

                        inputElementSender.AddHandler(FrameworkElement.ContextMenuClosingEvent, handleContextMenuClosed);
                        dObjSender.SetValue(FrameworkElement.ContextMenuProperty, contextMenu);
                        contextMenu.IsOpen = true;
                    }
                }
            }
        }
Exemplo n.º 29
0
        public static DependencyObject GetTemplateElement(this DependencyObject dependencyObject, string elementName)
        {
            if (elementName == null)
            {
                return(null);
            }

            dependencyObject.SetBinding(ElementProperty, new Binding {
                ElementName = elementName, BindsDirectlyToSource = true, Mode = BindingMode.OneTime
            });

            var element = dependencyObject.GetValue(ElementProperty);

            dependencyObject.ClearValue(ElementProperty);

            return((DependencyObject)element);
        }
Exemplo n.º 30
0
        public static FrameworkElement GetTemplatedParent(this DependencyObject dependencyObject)
        {
#if !SILVERLIGHT
            if (dependencyObject is FrameworkElement fre)
            {
                return((FrameworkElement)fre.TemplatedParent);
            }
#endif

            BindingOperations.SetBinding(dependencyObject, ElementProperty, TemplatedParentBinding);

            var element = dependencyObject.GetValue(ElementProperty);

            dependencyObject.ClearValue(ElementProperty);

            return((FrameworkElement)element);
        }
 private void SetTextFontSize(DependencyObject textElement, DependencyProperty fontSizeProperty)
 {
     double newFontSize = this.FontSize;
     if (double.IsNaN(newFontSize))
     {
         textElement.ClearValue(fontSizeProperty);
     }
     else
     {
         textElement.SetValue(fontSizeProperty, newFontSize);
     }
 }
Exemplo n.º 32
0
        internal static void UnlinkContainerFromItem(DependencyObject container, object item, IGeneratorHost host)
        {
            // When a container is removed from the tree, its future takes one of
            // two forms:
            //      a) [normal mode] the container becomes eligible for GC
            //      b) [recycling mode] the container joins the recycled list, and
            //          possibly re-enters the tree at some point, usually with a
            //          different item.
            //
            // As Dev10 bug 452669 and some "subtle issues" that arose in the
            // container recycling work illustrate, it's important that the container
            // and its subtree sever their connection to the data item.  Otherwise
            // you can get aliasing - a dead container reacting to the same item as a live
            // container.  Even without aliasing, it's a perf waste for a dead container
            // to continue reacting to its former data item.
            //
            // On the other hand, it's a perf waste to spend too much effort cleaning
            // up the container and its subtree, since they will often just get GC'd
            // in the near future.
            //
            // WPF initially did a full cleanup of the container, removing all properties
            // that were set in PrepareContainerForItem.  This avoided aliasing, but
            // was deemed too expensive, especially for scrolling.  For Windows OS Bug
            // 1445288, all this cleanup work was removed.  This sped up scrolling, but
            // introduced the problems cited in Dev10 452669 and the recycling "subtle
            // issues".  A compromise is needed.
            //
            // The compromise is tell the container to attach to a sentinel item
            // BindingExpressionBase.DisconnectedItem.  We allow this to propagate into the
            // conainer's subtree through properties like DataContext and
            // ContentControl.Content that are normally set by PrepareItemForContainer.
            // A Binding that sees the sentinel as the data item will disconnect its
            // event listeners from the former data item, but will not change its
            // own value or invalidate its target property.  This avoids the cost
            // of re-measuring most of the subtree.

            container.ClearValue(ItemForItemContainerProperty);

            // TreeView virtualization requires that we call ClearContainer before setting
            // the DataContext to "Disconnected".  This gives the TreeViewItems a chance
            // to save "Item values" in the look-aside table, before that table is
            // discarded.   (See Dev10 628778)
            host.ClearContainerForItem(container, item);

            if (container != item)
            {
                DependencyProperty dp = FrameworkElement.DataContextProperty;

                #if DEBUG
                // Some ancient code at this point handled the case when DataContext
                // was set via an Expression (presumably a binding).  I don't think
                // this actually happens any more.  Just in case...
                EntryIndex entryIndex = container.LookupEntry(dp.GlobalIndex);
                Debug.Assert(!container.HasExpression(entryIndex, dp), "DataContext set by expression (unexpectedly)");
                #endif

                container.SetValue(dp, BindingExpressionBase.DisconnectedItem);
            }
        }
Exemplo n.º 33
0
        // establish the link from the container to the corresponding item
        internal static void LinkContainerToItem(DependencyObject container, object item)
        {
            // always set the ItemForItemContainer property
            container.ClearValue(ItemForItemContainerProperty);
            container.SetValue(ItemForItemContainerProperty, item);

            // for non-direct items, set the DataContext property
            if (container != item)
            {
                #if DEBUG
                // Some ancient code at this point handled the case when DataContext
                // was set via an Expression (presumably a binding).  I don't think
                // this actually happens any more.  Just in case...
                DependencyProperty dp = FrameworkElement.DataContextProperty;
                EntryIndex entryIndex = container.LookupEntry(dp.GlobalIndex);
                Debug.Assert(!container.HasExpression(entryIndex, dp), "DataContext set by expression (unexpectedly)");
                #endif

                container.SetValue(FrameworkElement.DataContextProperty, item);
            }
        }
Exemplo n.º 34
0
        static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
            if (e.NewValue == e.OldValue) {
                return;
            }

            var messageTriggers = (TriggerBase[])d.GetValue(MessageTriggersProperty);

#if WinRT81
            var allTriggers = Interaction.GetBehaviors(d);

            if (messageTriggers != null)
            {
                messageTriggers.OfType<DependencyObject>().Apply(x => allTriggers.Remove(x));
            }

            var newTriggers = Parser.Parse(d, e.NewValue as string).ToArray();
            newTriggers.OfType<DependencyObject>().Apply(allTriggers.Add);
#else
            var allTriggers = Interaction.GetTriggers(d);

             if (messageTriggers != null) {
                messageTriggers.Apply(x => allTriggers.Remove(x));
            }

            var newTriggers = Parser.Parse(d, e.NewValue as string).ToArray();
            newTriggers.Apply(allTriggers.Add);
#endif

            if (newTriggers.Length > 0) {
                d.SetValue(MessageTriggersProperty, newTriggers);
            }
            else {
                d.ClearValue(MessageTriggersProperty);
            }
        }
Exemplo n.º 35
0
 /// <summary>
 /// Remove data Binding (if any) from a property. 
 /// </summary>
 /// <param name="target">Object from which to remove Binding</param>
 /// <param name="property">Property from which to remove Binding</param> 
 public static void ClearBinding(DependencyObject target, DependencyProperty property)
 {
     if (IsDataBound(target, property))
         target.ClearValue(property);
 }
Exemplo n.º 36
-1
 public static void ClearFriendlyName(DependencyObject dependencyObject)
 {
     if (dependencyObject != null)
     {
         dependencyObject.ClearValue (FriendlyNameProperty);
     }
 }
Exemplo n.º 37
-1
 public static void ClearData(DependencyObject dependencyObject)
 {
     if (dependencyObject != null)
     {
         dependencyObject.ClearValue (DataProperty);
     }
 }