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


C# DependencyObject.SetValue方法代码示例

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


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

示例1: 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

示例2: SetElementPolicy

        private static void SetElementPolicy(DependencyObject element, string code, OperationAction action)
        {
            if (SystemInfo.OperationCodes == null || SystemInfo.OperationCodes.Count == 0)
                return;

            var containCode = SystemInfo.OperationCodes.Contains(code);
            if (containCode)
                return;

            switch (action)
            {
                case OperationAction.Disable:
                    {
                        element.SetValue(Control.IsEnabledProperty, false);
                        element.SetValue(Control.VisibilityProperty, Visibility.Visible);
                        break;
                    }
                case OperationAction.Hide:
                    {
                        element.SetValue(Control.VisibilityProperty, Visibility.Collapsed);
                        element.SetValue(Control.IsEnabledProperty, true);
                        break;
                    }
                default:
                    break;
            }

        }
开发者ID:RandyCode,项目名称:SimpleTools,代码行数:28,代码来源:Operation.cs

示例3: SetTextLength

 public static void SetTextLength(DependencyObject obj, int value)
 {
     obj.SetValue(TextLengthProperty, value);
     if (value >= 1)
         obj.SetValue(HasTextProperty, true);
     else obj.SetValue(HasTextProperty, false);
 }
开发者ID:Wdovin,项目名称:vc-community,代码行数:7,代码来源:PasswordboxWatermarkTextHelper.cs

示例4: SetTextLength

 private static void SetTextLength(
                                   DependencyObject obj,
                                   int value)
 {
     obj.SetValue(TextLengthProperty, value);
     obj.SetValue(HasTextProperty, value >= 1);
 }
开发者ID:llenroc,项目名称:Inflexion2,代码行数:7,代码来源:MyTextBox.cs

示例5: SetPropertyValueOnTarget

        public static bool SetPropertyValueOnTarget(DependencyObject target, string propertyName,bool ballowed)
        {
            var prop = GetDependencyProperty(target, propertyName);

            if (target.GetValue(prop) == null || target.GetValue(prop).GetType() == typeof(string))
            {
                if (!ballowed)
                {
                    target.SetValue(prop, String.Empty);
                }
                return true;
            }

            if (target.GetValue(prop).GetType() == typeof(bool))
            {
                target.SetValue(prop, ballowed);
                return true;
            }

            if (target.GetValue(prop).GetType() == typeof(Visibility))
            {
                if (ballowed)
                {
                    target.SetValue(prop, Visibility.Visible);
                }
                else
                {
                    target.SetValue(prop, Visibility.Collapsed);
                }
                return true;
            }

            return false;
        }
开发者ID:Attention,项目名称:NitpickHouseV2,代码行数:34,代码来源:ResourceAccessHelper.cs

示例6: OnIconPropertyChanged

        private static void OnIconPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
#if NET40
            d.SetValue(TextOptions.TextRenderingModeProperty, TextRenderingMode.ClearType);
#endif
            d.SetValue(FontFamilyProperty, FontAwesomeFontFamily);
            d.SetValue(TextAlignmentProperty, TextAlignment.Center);
            d.SetValue(TextProperty, char.ConvertFromUtf32((int)e.NewValue));
        }
开发者ID:ImaginaryDevelopment,项目名称:Font-Awesome-WPF,代码行数:9,代码来源:FontAwesome.cs

示例7: OnPropertyChanged

		private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			var sourceValue = d.GetValue(ExtendedBinding.SourceProperty);
			var targetValue = d.GetValue(ExtendedBinding.TargetProperty);
			if (e.Property == ExtendedBinding.SourceProperty && !object.ReferenceEquals(sourceValue, targetValue))
				d.SetValue(ExtendedBinding.TargetProperty, sourceValue);
			else if (e.Property == ExtendedBinding.TargetProperty && !object.ReferenceEquals(sourceValue, targetValue))
				d.SetValue(ExtendedBinding.SourceProperty, targetValue);
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:9,代码来源:ExtendedBinding.cs

示例8: OnUseLayoutRoundingChanged

 private static void OnUseLayoutRoundingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.SetValue(UIElement.SnapsToDevicePixelsProperty, true);
     #if NET35
     #else
     RenderOptions.SetClearTypeHint(d, ClearTypeHint.Enabled);
     d.SetValue(FrameworkElement.UseLayoutRoundingProperty, true);
     #endif
 }
开发者ID:Chavjoh,项目名称:RssSimpleStream,代码行数:9,代码来源:FrameworkHelper.cs

示例9: SetAttachedProperties

        private void SetAttachedProperties(DependencyObject element)
        {
            if (Positioned) return;

            element.SetValue(Grid.RowProperty, Row);
            element.SetValue(Grid.ColumnProperty, Column);
            element.SetValue(Grid.RowSpanProperty, RowSpan);
            element.SetValue(Grid.ColumnSpanProperty, ColumnSpan);

            Positioned = true;
        }
开发者ID:NALSS,项目名称:web_dashboard,代码行数:11,代码来源:Unit.cs

示例10: ExpressionPropertyChangedCallback

 public static void ExpressionPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     try
     {
         d.SetValue(RegExpressionProperty, new Regex(e.NewValue.ToString()));
     }
     catch
     {
         d.SetValue(RegExpressionProperty, null);
     }
     
 }
开发者ID:JuRogn,项目名称:OA,代码行数:12,代码来源:RegexValidator.cs

示例11: SetSelectedItemsSource

        public static void SetSelectedItemsSource(DependencyObject element, IList value)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            element.SetValue(SelectedItemsSourceProperty, value);
        }
开发者ID:blacker-cz,项目名称:MangaScraper,代码行数:7,代码来源:ListBoxExtension.cs

示例12: SetSortField

        public static void SetSortField(DependencyObject obj, string value)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

            obj.SetValue(SortFieldProperty, value);
        }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:7,代码来源:SortableListViewBehavior.cs

示例13: SetHeaderSort

        public static void SetHeaderSort(DependencyObject obj, bool value)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

            obj.SetValue(HeaderSortProperty, value);
        }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:7,代码来源:SortableListViewBehavior.cs

示例14: OnDriveChanged

		public static void OnDriveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			FreeSpaceInfo o = (FreeSpaceInfo)d;
			// check if the drive property is empty
			if (((string)e.NewValue).Length > 0)
			{
				// get data about the drive
				o.currentDriveInfo = new DriveInfo((string)e.NewValue);
				// set dependency property
				d.SetValue(FreeSpaceRatioProperty, 
					Convert.ToDouble(o.currentDriveInfo.TotalFreeSpace) / o.currentDriveInfo.TotalSize);
			}
			else
				// no drive has been selected -> set free space ratio to zero
				d.SetValue(FreeSpaceRatioProperty, 0.0);
		}
开发者ID:mkandroid15,项目名称:Samples,代码行数:16,代码来源:FreeSpaceInfo.cs

示例15: SetWidthPix

 /// <summary>
 /// 
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="value"></param>
 public static void SetWidthPix(DependencyObject obj, int value)
 {
     if (value > 0)
     {
         obj.SetValue(WidthPixProperty, value);
     }
 }
开发者ID:nick121212,项目名称:xima_desktop,代码行数:12,代码来源:TilePanel.cs


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