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


C# UIElement.ReadLocalValue方法代码示例

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


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

示例1: CellRange

 /// <summary>
 ///     Initializes a new instance of a <see cref="T:C1.WPF.FlexGrid.CellRange" /> based on a
 ///     <see cref="T:System.Windows.UIElement" /> that represents a cell.
 /// </summary>
 /// <param name="e">
 ///     <see cref="T:System.Windows.UIElement" /> that represents a cell.
 /// </param>
 public CellRange(UIElement e)
 {
     if (e.ReadLocalValue(Grid.RowProperty) == DependencyProperty.UnsetValue)
     {
         _row = _col = _row2 = _col2 = -1;
         return;
     }
     _row = (int) e.GetValue(Grid.RowProperty);
     _col = (int) e.GetValue(Grid.ColumnProperty);
     _row2 = _row + (int) e.GetValue(Grid.RowSpanProperty) - 1;
     _col2 = _col + (int) e.GetValue(Grid.ColumnSpanProperty) - 1;
 }
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:19,代码来源:CellRange.cs

示例2: TransferProperty

        private static void TransferProperty(UIElement original, UIElement clone, DependencyProperty originalProperty, DependencyProperty cloneProperty, TransferMode mode)
        {
            bool performTransfer = false;

            if ((mode & TransferMode.AlwaysTransfer) == TransferMode.AlwaysTransfer)
            {
                performTransfer |= DependencyPropertyHelper.GetValueSource(original, originalProperty).BaseValueSource > BaseValueSource.Default;
            }
            else if ((mode & TransferMode.OnlyTransferIfTemplateBound) == TransferMode.OnlyTransferIfTemplateBound)
            {
                performTransfer |= DependencyPropertyHelper.GetValueSource(original, originalProperty).BaseValueSource >= BaseValueSource.ParentTemplate;
            }

            if (performTransfer)
            {
                // Actually perform the transfer.

                BindingBase binding = BindingOperations.GetBindingBase(original, originalProperty);
                if (binding != null)
                {
                    // Transfer Bindings

                    BindingOperations.SetBinding(clone, cloneProperty, binding);
                }
                else
                {
                    Expression expr = original.ReadLocalValue(originalProperty) as Expression;
                    if (expr != null)
                    {
                        // Transfer DynamicResource

                        DynamicResourceExtension dynamicResource = _rreConverter.ConvertTo(expr, typeof(MarkupExtension)) as DynamicResourceExtension;
                        if (dynamicResource != null)
                        {
                            clone.SetValue(cloneProperty, dynamicResource.ProvideValue(null));
                        }
                    }
                    else
                    {
                        // Transfer other DPs

                        object originalValue = original.GetValue(originalProperty);
                        clone.SetValue(cloneProperty, CreateClone(originalValue));
                    }
                }
            }
        }
开发者ID:kasicass,项目名称:kasicass,代码行数:47,代码来源:RibbonHelper.cs

示例3: IsPropertySet

 static bool IsPropertySet(UIElement element, DependencyProperty d)
 {
     return element.ReadLocalValue(d) != DependencyProperty.UnsetValue;
 }
开发者ID:icsharpcode,项目名称:WpfDesigner,代码行数:4,代码来源:DesignPanel.cs

示例4: EnableElementNavigation

 private void EnableElementNavigation( UIElement child )
 {
   //checking only one of the 2 properties... This is because they are set together.
   if( child.ReadLocalValue( TableflowViewItemsHost.PreviousDirectionalNavigationModeProperty ) != DependencyProperty.UnsetValue )
   {
     KeyboardNavigation.SetDirectionalNavigation( child, TableflowViewItemsHost.GetPreviousDirectionalNavigationMode( child ) );
     KeyboardNavigation.SetTabNavigation( child, TableflowViewItemsHost.GetPreviousTabNavigationMode( child ) );
   }
   //If unset, then nothing to do in this method!
 }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:10,代码来源:TableflowViewItemsHost.cs

示例5: ShowAdorner

        private static void ShowAdorner(UIElement targetElement, bool show, bool retry = true)
        {
            if (targetElement == null)
            {
                return;
            }

            var adornerLayer = AdornerLayer.GetAdornerLayer(targetElement);
            if (adornerLayer == null)
            {
                if (retry)
                {
                    targetElement.Dispatcher.BeginInvoke(
                        DispatcherPriority.Loaded,
                        new Action(() => ShowAdorner(targetElement, show, false)));
                }

                return;
            }

            var adorner = targetElement.ReadLocalValue(AdornerProperty) as TemplatedAdorner;
            if (show && adorner == null)
            {
                var validationTemplate = GetTemplate(targetElement);
                if (validationTemplate != null)
                {
                    adorner = new TemplatedAdorner(targetElement, validationTemplate);
                    adornerLayer.Add(adorner);
                    targetElement.SetValue(AdornerProperty, adorner);
                }
            }
            else if (!show && adorner != null)
            {
                adorner.ClearChild();
                adornerLayer.Remove(adorner);
                targetElement.ClearValue(AdornerProperty);
            }
        }
开发者ID:bitbonk,项目名称:Toolbox,代码行数:38,代码来源:Adornment.cs

示例6: GetItemPosition

        private Rect GetItemPosition(Size arrangeSize, UIElement item)
        {
            if (item is ContentPresenter && item.ReadLocalValue(PositionProperty) == DependencyProperty.UnsetValue)
            { //should this be recursive until uielement with set Position is found?

                var elm = VisualTreeHelper.GetChild(item, 0) as UIElement;
                if (elm != null)
                    item = elm;
            }


            var pos = GetPosition(item);
            var range = GetRange(item);
            var align = GetAlignment(item);

            double x = 0;
            double y = 0;
            double w = item.DesiredSize.Width;
            double h = item.DesiredSize.Height;

            if (!double.IsNaN(range))
            {
                if ((Orientation == Orientation.Horizontal))
                    w = ScaleToSize(range, arrangeSize.Width);
                else
                    h = ScaleToSize(range, arrangeSize.Height);
            }


            Size size;

            if (Orientation == Orientation.Horizontal)
            {
                x = ScaleToSize(pos, arrangeSize.Width);
                size = new Size(w, arrangeSize.Height);
                x -= SizeAdjustment(align, w);
            }
            else
            {
                y = ScaleToSize(pos, arrangeSize.Height);
                size = new Size(arrangeSize.Width, h);
                y -= SizeAdjustment(align, h);
            }

            return new Rect(new Point(x, y), size);
        }
开发者ID:mihailim,项目名称:PoESkillTree,代码行数:46,代码来源:RangePanel.cs

示例7: AddToValidControls

	    private static void AddToValidControls(UIElement element)
	    {
			bool isTiltable = false;
			bool isForcedSuppress = element.ReadLocalValue(SuppressTiltProperty) is bool && (bool) element.ReadLocalValue(SuppressTiltProperty);


			if (!isForcedSuppress && TiltableItems.Any(t => TypeExtensions.IsTypeOf(element, t)))
		    {
			    isTiltable = true;

#if WINDOWS_STORE
				element.PointerMoved += InitiateTiltEffect;
#elif WINDOWS_PHONE
				element.ManipulationStarted += InitiateTiltEffect;
#endif
		    }

		    // hit a child with a tilt ability, 
			// having a control within a control having tilt is redundant
		    if (isTiltable)
				return;

		    var children = element.GetVisualChildren();

		    foreach (var child in children)
		    {
			    AddToValidControls(child as FrameworkElement);
		    }
	    }
开发者ID:selaromdotnet,项目名称:Coding4FunToolkit,代码行数:29,代码来源:TiltEffect.cs


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