当前位置: 首页>>代码示例>>C#>>正文


C# Windows.DependencyPropertyChangedEventArgs类代码示例

本文整理汇总了C#中System.Windows.DependencyPropertyChangedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DependencyPropertyChangedEventArgs类的具体用法?C# DependencyPropertyChangedEventArgs怎么用?C# DependencyPropertyChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DependencyPropertyChangedEventArgs类属于System.Windows命名空间,在下文中一共展示了DependencyPropertyChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnSizeChanged

        private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var image = d as Image;
            if (image == null)
            {
                throw new ArgumentException(
                    "You must set the Command attached property on an element that derives from Image.");
            }

            var oldCommand = (bool)e.OldValue;
            if (oldCommand)
            {
                image.Loaded -= OnLoaded;
                image.SizeChanged -= OnSizeChanged;
            }

            var newCommand = (bool)e.NewValue;
            if (newCommand)
            {
                image.Loaded += OnLoaded;
                image.SizeChanged += OnSizeChanged;
            }

            image.CropImageBorders();
        }
开发者ID:wooda77,项目名称:DMI-Byvejr,代码行数:25,代码来源:ImageExtension.cs

示例2: OnModelChanged

 /// <summary>
 /// Provides derived classes an opportunity to handle changes to the Model property.
 /// </summary>
 protected virtual void OnModelChanged(DependencyPropertyChangedEventArgs e)
 {
     if (Model != null)
         SetLayoutItem(Model.Root.Manager.GetLayoutItemFromModel(Model));
     else
         SetLayoutItem(null);
 }
开发者ID:peterschen,项目名称:SMAStudio,代码行数:10,代码来源:LayoutAnchorableControl.cs

示例3: OnScrollGroupChanged

        private static void OnScrollGroupChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
            var scrollViewer = d as ScrollViewer;
            if (scrollViewer != null) {
                if (!string.IsNullOrEmpty((string)e.OldValue)) {
                    // Remove scrollviewer
                    if (scrollViewers.ContainsKey(scrollViewer)) {
                        scrollViewer.ScrollChanged -=
                          new ScrollChangedEventHandler(ScrollViewer_ScrollChanged);
                        scrollViewers.Remove(scrollViewer);
                    }
                }

                if (!string.IsNullOrEmpty((string)e.NewValue)) {
                    if (verticalScrollOffsets.Keys.Contains((string)e.NewValue)) {
                        scrollViewer.ScrollToVerticalOffset(verticalScrollOffsets[(string)e.NewValue]);
                    } else {
                        verticalScrollOffsets.Add((string)e.NewValue, scrollViewer.VerticalOffset);
                    }

                    // Add scrollviewer
                    scrollViewers.Add(scrollViewer, (string)e.NewValue);
                    scrollViewer.ScrollChanged += new ScrollChangedEventHandler(ScrollViewer_ScrollChanged);
                }
            }
        }
开发者ID:mmalek06,项目名称:FunkyCodeEditor,代码行数:25,代码来源:ScrollSynchronizer.cs

示例4: OnAttachChanged

 public static void OnAttachChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     var passwordBox = sender as PasswordBox;
     if (passwordBox == null) return;
     if ((bool)e.OldValue) passwordBox.PasswordChanged -= PasswordChanged;
     if ((bool)e.NewValue) passwordBox.PasswordChanged += PasswordChanged;
 }
开发者ID:dragosIDL,项目名称:ShareApp,代码行数:7,代码来源:PasswordHelper.cs

示例5: OnScrollOnTextChanged

 static void OnScrollOnTextChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     var textBox = dependencyObject as TextBox;
     if (textBox == null)
     {
         return;
     }
     bool oldValue = (bool)e.OldValue, newValue = (bool)e.NewValue;
     if (newValue == oldValue)
     {
         return;
     }
     if (newValue)
     {
         textBox.Loaded += TextBoxLoaded;
         textBox.Unloaded += TextBoxUnloaded;
     }
     else
     {
         textBox.Loaded -= TextBoxLoaded;
         textBox.Unloaded -= TextBoxUnloaded;
         if (_associations.ContainsKey(textBox))
         {
             _associations[textBox].Dispose();
         }
     }
 }
开发者ID:Northcode,项目名称:MCM-reboot,代码行数:27,代码来源:TextBoxBehaviour.cs

示例6: OnSourceChanged

        /// <summary>
        /// Provides derived classes an opportunity to handle changes to the Source property.
        /// </summary>
        protected virtual void OnSourceChanged(DependencyPropertyChangedEventArgs e)
        {
            ClearAnimation();

            var source = e.NewValue as BitmapImage;
            if(source == null) {
                Uri uri = e.NewValue as Uri;

                if(uri == null) {
                    var bitmapframe = e.NewValue as BitmapFrame;

                    if(bitmapframe == null) {
                        var imgsrc = e.NewValue as ImageSource;
                        base.Source = imgsrc;
                        return;
                    }

                    uri = new Uri(e.NewValue.ToString());
                }

                source = new BitmapImage();
                source.BeginInit();
                source.UriSource = uri;
                source.CacheOption = BitmapCacheOption.OnLoad;
                source.EndInit();
            }

            if(!IsAnimatedGifImage(source)) {
                base.Source = source;
                return;
            }

            PrepareAnimation(source);
        }
开发者ID:samuelabj,项目名称:EpisodeTracker,代码行数:37,代码来源:AnimatedImage.cs

示例7: Generate

 /// <summary>
 ///     Sets the coordinates of all the individual lines in the visual.
 /// </summary>
 /// <param name="args">
 ///     The <c>DependencyPropertyChangedEventArgs</c> object associated 
 ///     with the property-changed event that resulted in this method 
 ///     being called.
 /// </param>
 /// <param name="lines">
 ///     The <c>Point3DCollection</c> to be filled.
 /// </param>
 /// <remarks>
 ///     <para>
 ///         Classes that derive from <c>WireBase</c> override this
 ///         method to fill the <c>lines</c> collection.
 ///         It is custmary for implementations of this method to clear
 ///         the <c>lines</c> collection first before filling it. 
 ///         Each pair of successive members of the <c>lines</c>
 ///         collection indicate one straight line.
 ///     </para>
 ///     <para>
 ///         The <c>WireLine</c> class implements this method by 
 ///         clearing the <c>lines</c> collection and then adding 
 ///         <c>Point1</c> and <c>Point2</c> to the collection.
 ///     </para>
 /// </remarks>
 protected override void Generate(DependencyPropertyChangedEventArgs args, 
                                  Point3DCollection lines)
 {
     lines.Clear();
     lines.Add(Point1);
     lines.Add(Point2);
 }
开发者ID:samlcharreyron,项目名称:PedestrianTracker,代码行数:33,代码来源:WireLine.cs

示例8: OnDeckChanged

 private static void OnDeckChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     var viewer = d as DeckCardsViewer;
     var newdeck = e.NewValue as MetaDeck ?? new MetaDeck(){IsCorrupt = true};
     var g = GameManager.Get().GetById(newdeck.GameId);
     viewer.deck = newdeck.IsCorrupt ?
         null
         : g == null ?
             null
             : newdeck;
     viewer._view = viewer.deck == null ? 
         new ListCollectionView(new List<MetaMultiCard>()) 
         : new ListCollectionView(viewer.deck.Sections.SelectMany(x => x.Cards).ToList());
     viewer.OnPropertyChanged("Deck");
     viewer.OnPropertyChanged("SelectedCard");
     Task.Factory.StartNew(
         () =>
         {
             Thread.Sleep(0);
             viewer.Dispatcher.BeginInvoke(new Action(
                 () =>
                 {
                     viewer.FilterChanged(viewer._filter);
                 }));
         });
     
 }
开发者ID:rexperalta,项目名称:OCTGN,代码行数:27,代码来源:DeckCardsViewer.xaml.cs

示例9: OnIsPivotAnimatedChanged

    private static void OnIsPivotAnimatedChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
    {
      ItemsControl list = d as ItemsControl;

      list.Loaded += (s2, e2) =>
        {
          // locate the pivot control that this list is within
          Pivot pivot = list.Ancestors<Pivot>().Single() as Pivot;

          // and its index within the pivot
          int pivotIndex = pivot.Items.IndexOf(list.Ancestors<PivotItem>().Single());

          bool selectionChanged = false;

          pivot.SelectionChanged += (s3, e3) =>
            {
              selectionChanged = true;
            };

          // handle manipulation events which occur when the user
          // moves between pivot items
          pivot.ManipulationCompleted += (s, e) =>
            {
              if (!selectionChanged)
                return;

              selectionChanged = false;

              if (pivotIndex != pivot.SelectedIndex)
                return;
              
              // determine which direction this tab will be scrolling in from
              bool fromRight = e.TotalManipulation.Translation.X <= 0;

              // locate the stack panel that hosts the items
              VirtualizingStackPanel vsp = list.Descendants<VirtualizingStackPanel>().First() as VirtualizingStackPanel;

              // iterate over each of the items in view
              int firstVisibleItem = (int)vsp.VerticalOffset;
              int visibleItemCount = (int)vsp.ViewportHeight;
              for (int index = firstVisibleItem; index <= firstVisibleItem + visibleItemCount; index++)
              {
                // find all the item that have the AnimationLevel attached property set
                var lbi = list.ItemContainerGenerator.ContainerFromIndex(index);
                if (lbi == null)
                  continue;

                vsp.Dispatcher.BeginInvoke(() =>
                  {
                    var animationTargets = lbi.Descendants().Where(p => ListAnimation.GetAnimationLevel(p) > -1);
                    foreach (FrameworkElement target in animationTargets)
                    {
                      // trigger the required animation
                      GetAnimation(target, fromRight).Begin();
                    }
                  });
              };
            };
        };
    }
开发者ID:Hitchhikrr,项目名称:WP7-RMM-Project,代码行数:60,代码来源:ListAnimation.cs

示例10: OnGroupNameChanged

        private static void OnGroupNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //Add an entry to the group name collection
            var menuItem = d as MenuItem;

            if (menuItem != null)
            {
                String newGroupName = e.NewValue.ToString();
                String oldGroupName = e.OldValue.ToString();
                if (String.IsNullOrEmpty(newGroupName))
                {
                    //Removing the toggle button from grouping
                    RemoveCheckboxFromGrouping(menuItem);
                }
                else
                {
                    //Switching to a new group
                    if (newGroupName != oldGroupName)
                    {
                        if (!String.IsNullOrEmpty(oldGroupName))
                        {
                            //Remove the old group mapping
                            RemoveCheckboxFromGrouping(menuItem);
                        }
                        ElementToGroupNames.Add(menuItem, e.NewValue.ToString());
                        menuItem.Checked += MenuItemChecked;
                    }
                }
            }
        }
开发者ID:borndead,项目名称:PoESkillTree,代码行数:30,代码来源:MenuItemExtensions.cs

示例11: KPage_VisibleChanged

        /// <summary>
        /// Wird bei Seitenwechsel aufgerufen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void KPage_VisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (!((KPage)sender).IsVisible)     // Beim Verlassen der Seite nichts machen
                return;

            refreshDataGrid();
        }
开发者ID:ramteid,项目名称:KoeTaf,代码行数:12,代码来源:pCashClosureSubmit.xaml.cs

示例12: AnnotationsGroupChanged

        private static void AnnotationsGroupChanged(DependencyObject target, DependencyPropertyChangedEventArgs args)
        {
            RadCartesianChart chart = target as RadCartesianChart;
            if (chart == null)
            {
                return;
            }

            string group = (string)args.NewValue;
            if (group != null && !attachedCharts.Contains(chart))
            {
                attachedCharts.Add(chart);
                chart.MouseMove += Chart_MouseMove;
                chart.MouseLeave += Chart_MouseLeave;
            }
            else if (group == null)
            {
                chart.MouseMove -= Chart_MouseMove;
                attachedCharts.Remove(chart);
                chart.MouseLeave -= Chart_MouseLeave;

                if (lastMouseOveredChart == chart)
                {
                    lastMouseOveredChart = null;
                }
            }
        }
开发者ID:CJMarsland,项目名称:xaml-sdk,代码行数:27,代码来源:ChartUtilities.cs

示例13: OnTransformChanged

 private static void OnTransformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.SetValue(UIElement.RenderTransformProperty, e.NewValue);
     if (TrackableRenderTransform.TransformChanged == null)
         return;
     TrackableRenderTransform.TransformChanged(d, e);
 }
开发者ID:sulerzh,项目名称:chart,代码行数:7,代码来源:TrackableRenderTransform.cs

示例14: TextboxInlinesPropertyChanged

 private static void TextboxInlinesPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     var textBlock = d as TextBlock;
     if (textBlock == null)
         return;
     SetTextBlockInlines(textBlock, e.NewValue as IEnumerable<Inline>);
 }
开发者ID:mihailim,项目名称:PoESkillTree,代码行数:7,代码来源:ItemConverter.cs

示例15: OnValidSpinDirectionPropertyChanged

 /// <summary>
 /// ValidSpinDirectionProperty property changed handler.
 /// </summary>
 /// <param name="d">ButtonSpinner that changed its ValidSpinDirection.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnValidSpinDirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     Spinner source = (Spinner)d;
     ValidSpinDirections oldvalue = (ValidSpinDirections)e.OldValue;
     ValidSpinDirections newvalue = (ValidSpinDirections)e.NewValue;
     source.OnValidSpinDirectionChanged(oldvalue, newvalue);
 }
开发者ID:DelvarWorld,项目名称:shadercomposer,代码行数:12,代码来源:Spinner.cs


注:本文中的System.Windows.DependencyPropertyChangedEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。