• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Windows.DependencyPropertyChangedEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SecurityBlockSelection_DataContextChanged

        private void SecurityBlockSelection_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            SecurityManagementBox.ItemsSource = null;

            SecurityManagementBox.Visibility = Visibility.Collapsed;
            IManagementConsoleObject securityObject = e.NewValue as IManagementConsoleObject;
            if (securityObject != null)
            {
                if (securityObject is RootMap)
                {
                    NoAssociationsWarningTextblock.Text = ROOTMAP_WARNING;
                }
                else if (securityObject is Project)
                {
                    NoAssociationsWarningTextblock.Text = PROJECT_WARNING;
                }

                if (securityObject.IsLoaded)
                {
                    if (securityObject.HasNoSecurityAssociations)
                    {
                        NoAssociationWarning.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        NoAssociationWarning.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    securityObject.LoadCompleted += securityObject_LoadCompleted;
                }
            }
        }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:34,代码来源:SecurityManagementControl.xaml.cs


示例17: IsReadOnlyPropertyChangedCallback

 private static void IsReadOnlyPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     if (e.OldValue != e.NewValue && e.NewValue != null) {
         var numUpDown = (NumericUpDown)dependencyObject;
         numUpDown.ToggleReadOnlyMode((bool)e.NewValue);
     }
 }
开发者ID:hmfautec,项目名称:MahApps.Metro,代码行数:7,代码来源:NumericUpDown.cs


示例18: ThemeToolsGroup_OnIsVisibleChanged

 private void ThemeToolsGroup_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (ThemeToolsGroup.IsVisible)
     {
         RibbonRoot.SelectedTabItem = ThemeToolsTabItem;
     }
 }
开发者ID:Helly1337,项目名称:Filtration,代码行数:7,代码来源:MainWindow.xaml.cs


示例19: OnPanelContentPropertyChanged

        private static void OnPanelContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            try
            {
                ParentPanel item = d as ParentPanel;
                ICleanup oldValue = e.OldValue as ICleanup;

                if (oldValue != null)
                {
                    oldValue.Cleanup();
                    oldValue = null;
                }
                if (e.NewValue != null)
                {
                    item.ParentContent.Content = null;

                    item.ParentContent.Content = e.NewValue;

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:JuRogn,项目名称:OA,代码行数:25,代码来源:ParentPanel.xaml.cs


示例20: BusyCountChangedCallback

 private static void BusyCountChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (0.Equals(e.NewValue))
         SetIsBusy(d, false);
     else
         SetIsBusy(d, true);
 }
开发者ID:Titaye,项目名称:SLExtensions,代码行数:7,代码来源:IsBusyExtensions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Windows.DependencyPropertyKey类代码示例发布时间:2022-05-26
下一篇:
C# Windows.DependencyProperty类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap