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


C# DependencyObject.GetValue方法代码示例

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


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

示例1: GetAttachedDataContext

        /// <summary>
        /// Gets the value of the <strong>AttachedDataContext</strong> attached property from a given 
        /// <see cref="DependencyObject"/> object.
        /// </summary>
        /// <param name="obj">The object from which to read the property value.</param>
        /// <return>The value of the <strong>AttachedDataContext</strong> attached property.</return>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="obj"/> is <see langword="null"/>.
        /// </exception>
        public static object GetAttachedDataContext(DependencyObject obj)
        {
            if (obj == null)
            throw new ArgumentNullException("obj");

              return obj.GetValue(AttachedDataContextProperty);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:16,代码来源:BindingHelper.cs

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

示例3: GetPushBindings

 public static PushBindingCollection GetPushBindings(DependencyObject obj)
 {
     if (obj.GetValue(PushBindingsProperty) == null)
     {
         obj.SetValue(PushBindingsProperty, new PushBindingCollection(obj));
     }
     return (PushBindingCollection)obj.GetValue(PushBindingsProperty);
 }
开发者ID:iGad,项目名称:EmblemPaint,代码行数:8,代码来源:PushBindingManager.cs

示例4: ColumnPropertiesGroup

 // ------------------------------------------------------------------
 // Constructor.
 // Remarks - the pageWidth parameter can be used to limit column
 // properties if the element is a FlowDocument.
 // ------------------------------------------------------------------
 internal ColumnPropertiesGroup(DependencyObject o)
 {
     _columnWidth = (double)o.GetValue(FlowDocument.ColumnWidthProperty);
     _columnGap = (double)o.GetValue(FlowDocument.ColumnGapProperty);
     _columnRuleWidth = (double)o.GetValue(FlowDocument.ColumnRuleWidthProperty);
     _columnRuleBrush = (Brush)o.GetValue(FlowDocument.ColumnRuleBrushProperty);
     _isColumnWidthFlexible = (bool)o.GetValue(FlowDocument.IsColumnWidthFlexibleProperty);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:ColumnPropertiesGroup.cs

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

示例6: GetModifiedTypeface

        internal static Typeface GetModifiedTypeface(DependencyObject element, FontFamily fontFamily)
        {
            Debug.Assert(element != null); 

            FontStyle   fontStyle   = (FontStyle)   element.GetValue(TextElement.FontStyleProperty); 
            FontWeight  fontWeight  = (FontWeight)  element.GetValue(TextElement.FontWeightProperty); 
            FontStretch fontStretch = (FontStretch) element.GetValue(TextElement.FontStretchProperty);
 
            return new Typeface(fontFamily, fontStyle, fontWeight, fontStretch);
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:10,代码来源:DynamicPropertyReader.cs

示例7: GetConnectionPoints

 internal static List<ConnectionPoint> GetConnectionPoints(DependencyObject obj)
 {
     if (obj is StartSymbol)
     {
         return (List<ConnectionPoint>)obj.GetValue(StateContainerEditor.ConnectionPointsProperty);
     }
     if (!(obj is VirtualizedContainerService.VirtualizingContainer))
     {
         obj = VisualTreeUtils.FindVisualAncestor<VirtualizedContainerService.VirtualizingContainer>(obj);
     }
     return (List<ConnectionPoint>)obj.GetValue(StateContainerEditor.ConnectionPointsProperty);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:StateContainerEditor.Utilities.cs

示例8: OnTimeChanged

 private static void OnTimeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     DoubleAnimation animation = (DoubleAnimation)sender;
     double time = GetTime(animation);
     Thickness from = (Thickness)sender.GetValue(FromProperty);
     Thickness to = (Thickness)sender.GetValue(ToProperty);
     DependencyProperty targetProperty = (DependencyProperty)sender.GetValue(TargetPropertyProperty);
     DependencyObject target = (DependencyObject)sender.GetValue(TargetProperty);
     target.SetValue(targetProperty, new Thickness((to.Left - from.Left) * time + from.Left,
                                                   (to.Top - from.Top) * time + from.Top,
                                                   (to.Right - from.Right) * time + from.Right,
                                                   (to.Bottom - from.Bottom) * time + from.Bottom));
 }
开发者ID:ErikPel,项目名称:windows-phone,代码行数:13,代码来源:ThicknessAnimation.cs

示例9: AnimateEasingEquation

        public static AnimationClock AnimateEasingEquation(
            DependencyObject element,
            DependencyProperty prop,
            EasingFunction function,            
            double to,
            int durationMS)
        {
            double from = double.IsNaN((double)element.GetValue(prop)) ?
                                0 :
                                (double)element.GetValue(prop);

            AnimationTimeline timeline = GetEasingAnimation(function, EasingMode.EaseIn, from, to, durationMS);
            return Animate(element, prop, timeline, durationMS, null, null, null);
        }
开发者ID:qlestrelin,项目名称:icomierp,代码行数:14,代码来源:WPFAnimationHelper.cs

示例10: GetBoundPassword

        public static string GetBoundPassword(DependencyObject d)
        {
            var box = d as PasswordBox;
            if (box == null)
                return (string) d.GetValue(BoundPasswordProperty);

            box.PasswordChanged -= PasswordChanged;
            box.PasswordChanged += PasswordChanged;

            var password = box.ToString();
            if (password != null)
                SetSelection(box, password.Length, 0);

            return (string)d.GetValue(BoundPasswordProperty);
        }
开发者ID:zizuiZ,项目名称:petshop_pss,代码行数:15,代码来源:PasswordBoxHelper.cs

示例11: GetSortInfo

        public static SortInfo GetSortInfo(DependencyObject obj)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

            return (SortInfo)obj.GetValue(SortInfoProperty.DependencyProperty);
        }
开发者ID:nankezhishi,项目名称:ClearMine,代码行数:7,代码来源:SortableListViewBehavior.cs

示例12: GetSortField

        public static string GetSortField(DependencyObject obj)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

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

示例13: GetHeaderSort

        public static bool GetHeaderSort(DependencyObject obj)
        {
            if (obj == null)
                throw new ArgumentNullException("obj");

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

示例14: GetSelectedItemsSource

        /// <summary>
        /// Gets the IList that contains the values that should be selected.
        /// </summary>
        /// <param name="element">The ListBox to check.</param>
        public static IList GetSelectedItemsSource(DependencyObject element)
        {
            if (element == null)
                throw new ArgumentNullException("element");

            return (IList)element.GetValue(SelectedItemsSourceProperty);
        }
开发者ID:DelLitt,项目名称:opmscoral,代码行数:11,代码来源:DataGridExtension.cs

示例15: return

        /// <summary>
        /// Gets the update source on change.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        /// <exception cref="System.ArgumentNullException">obj</exception>
        public static bool GetUpdateSourceOnChange
          (DependencyObject obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");

            return (bool)obj.GetValue(UpdateSourceOnChangeProperty);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:13,代码来源:TextBindingHelper.cs


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