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


C# DependencyObject.SetCurrentValue方法代码示例

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


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

示例1: PrepareContainerForItemOverride

        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            if (element != item)
                element.SetCurrentValue(DataContextProperty, item); //dont want to set the datacontext to itself. taken from MetroTabControl.cs

            base.PrepareContainerForItemOverride(element, item);
        }
开发者ID:gjhwssg,项目名称:MahApps.Metro,代码行数:7,代码来源:FlipView.cs

示例2: TintPropertyChanged

 private static void TintPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
 {
     var value = obj?.GetValue(TintProperty);
     if (!(value is Color)) return;
     var tint = (Color) value;
     obj.SetCurrentValue(LightTintProperty, tint.Lighten(0.1f));
     obj.SetCurrentValue(DarkTintProperty, tint.Darken(0.1f));
 }
开发者ID:robhendriks,项目名称:Quizlr,代码行数:8,代码来源:TileButton.cs

示例3: PrepareContainerForItemOverride

        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            if (!Equals(element, item))
                element.SetCurrentValue(DataContextProperty, item); //dont want to set the datacontext to itself.

            base.PrepareContainerForItemOverride(element, item);
        }
开发者ID:LionFree,项目名称:Cush,代码行数:7,代码来源:BaseTabControl.cs

示例4: InternalSetIsValid

 internal static void InternalSetIsValid(DependencyObject obj, bool value)
 {
     if (GetIsValid(obj) != value)
     {
         // Only change the value when it is different; otherwise unnecessary binding updates are raised.
         obj.SetCurrentValue(IsValidProperty, value);
     }
 }
开发者ID:hliang89,项目名称:WpfApplicationFramework,代码行数:8,代码来源:ValidationHelper.cs

示例5: Clone

        private static void Clone(DependencyObject from, DependencyObject to)
        {
            var localValueEnumerator = from.GetLocalValueEnumerator();
            while (localValueEnumerator.MoveNext())
            {
                if (localValueEnumerator.Current.Property.ReadOnly ||
                    localValueEnumerator.Current.Value is FrameworkElement) continue;

                if (!(localValueEnumerator.Current.Value is BindingExpressionBase))
                    to.SetCurrentValue(localValueEnumerator.Current.Property, localValueEnumerator.Current.Value);
            }
        }
开发者ID:thindev,项目名称:SmartScene,代码行数:12,代码来源:InterLayoutClient.cs

示例6: EnsureHidden

		static void EnsureHidden(DependencyObject d)
		{
			if (Visibility.Visible.Equals(d.GetValue(UIElement.VisibilityProperty))) {
				d.SetCurrentValue(UIElement.VisibilityProperty, Visibility.Hidden);
			}
		}
开发者ID:modulexcite,项目名称:WpfDesigner,代码行数:6,代码来源:DesignTimeProperties.cs

示例7: OnCellItemChanged

        private static void OnCellItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (Equals(d.GetValue(IsUpdatingProperty), BooleanBoxes.True))
            {
                return;
            }

            d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.True);
            try
            {
                var dataGrid = (DataGrid)d;
                dataGrid.UnselectAllCells();
                if (e.NewValue == null)
                {
                    dataGrid.SetIndex(null);
                    return;
                }

                for (var r = 0; r < dataGrid.Items.Count; r++)
                {
                    for (var c = 0; c < dataGrid.Columns.Count; c++)
                    {
                        var column = dataGrid.Columns[c];
                        var cellItem = GetCellItem(column, dataGrid.Items[r]);
                        if (Equals(cellItem, e.NewValue))
                        {
                            var index = new RowColumnIndex(r, c);
                            dataGrid.SetIndex(index);
                            var cell = dataGrid.GetCell(index);
                            cell.SetCurrentValue(DataGridCell.IsSelectedProperty, true);
                            return;
                        }
                    }
                }

                dataGrid.SetIndex(null);
            }
            finally
            {
                d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.False);
            }
        }
开发者ID:JohanLarsson,项目名称:Gu.Wpf.DataGrid2D,代码行数:42,代码来源:Selected.cs

示例8: SetIsThreeState

 /// <summary>
 /// Sets the IsThreeState property.  This dependency property 
 /// indicates whether the control supports two or three states. 
 /// IsChecked can be set to null as a third state when IsThreeState is true.
 /// </summary>
 public static void SetIsThreeState(DependencyObject d, bool value)
 {
     d.SetCurrentValue(IsThreeStateProperty, value);
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:9,代码来源:VirtualToggleButton.cs

示例9: OnIndexChanged

        private static void OnIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (Equals(d.GetValue(IsUpdatingProperty), BooleanBoxes.True))
            {
                return;
            }

            d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.True);
            try
            {
                var dataGrid = (DataGrid)d;
                dataGrid.UnselectAllCells();
                var rowColumnIndex = (RowColumnIndex?)e.NewValue;
                if (rowColumnIndex == null)
                {
                    return;
                }

                var cell = dataGrid.GetCell(rowColumnIndex.Value);
                cell?.SetCurrentValue(DataGridCell.IsSelectedProperty, true);

                UpdateSelectedCellItemFromView(dataGrid);
            }
            finally
            {
                d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.False);
            }
        }
开发者ID:JohanLarsson,项目名称:Gu.Wpf.DataGrid2D,代码行数:28,代码来源:Selected.cs

示例10: SetIsVirtualToggleButton

 /// <summary>
 /// Sets the IsVirtualToggleButton property.  This dependency property 
 /// indicates whether the object to which the property is attached is treated as a VirtualToggleButton.  
 /// If true, the object will respond to keyboard and mouse input the same way a ToggleButton would.
 /// </summary>
 public static void SetIsVirtualToggleButton(DependencyObject d, bool value)
 {
     d.SetCurrentValue(IsVirtualToggleButtonProperty, value);
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:9,代码来源:VirtualToggleButton.cs

示例11: SetIsChecked

 /// <summary>
 /// Sets the IsChecked property.  This dependency property 
 /// indicates whether the toggle button is checked.
 /// </summary>
 public static void SetIsChecked(DependencyObject d, bool? value)
 {
     d.SetCurrentValue(IsCheckedProperty, value);
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:8,代码来源:VirtualToggleButton.cs

示例12: SetTargetVisual

		public static void SetTargetVisual(DependencyObject obj, UIElement value)
		{
            obj.SetCurrentValue(TargetVisualProperty, value);
		}
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:4,代码来源:BusyIndicatorBehavior.cs

示例13: SetDimmerOpacity

		public static void SetDimmerOpacity(DependencyObject obj, double value)
		{
            obj.SetCurrentValue(DimmerOpacityProperty, value);
		}
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:4,代码来源:BusyIndicatorBehavior.cs

示例14: SetDimBackground

		public static void SetDimBackground(DependencyObject obj, bool value)
		{
            obj.SetCurrentValue(DimBackgroundProperty, value);
		}
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:4,代码来源:BusyIndicatorBehavior.cs

示例15: OnSourceProxyChanged

 private static void OnSourceProxyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.SetCurrentValue(TargetProxyProperty, e.NewValue);
 }
开发者ID:JohanLarsson,项目名称:Gu.Wpf.PropertyGrid,代码行数:4,代码来源:OneWayToSource.cs


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