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

C# Visuals.UIElement类代码示例

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

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



UIElement类属于MediaPortal.UI.SkinEngine.Controls.Visuals命名空间,在下文中一共展示了UIElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AbstractTextInputHandler

 protected AbstractTextInputHandler(UIElement parentElement, SimplePropertyDataDescriptor textDataDescriptor,
     SimplePropertyDataDescriptor caretIndexDataDescriptor)
 {
   _parentElement = parentElement;
   _textDataDescriptor = textDataDescriptor;
   _caretIndexDataDescriptor = caretIndexDataDescriptor;
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:7,代码来源:AbstractTextInputHandler.cs


示例2: BindingDependency

 /// <summary>
 /// Creates a new <see cref="BindingDependency"/> object.
 /// </summary>
 /// <param name="sourceDd">Souce data descriptor for the dependency.</param>
 /// <param name="targetDd">Target data descriptor for the dependency.</param>
 /// <param name="autoAttachToSource">If set to <c>true</c>, the new dependency object will be
 /// automatically attached to the <paramref name="sourceDd"/> data descriptor. This means it will
 /// capture changes from it and reflect them on the <paramref name="targetDd"/> data descriptor.</param>
 /// <param name="updateSourceTrigger">This parameter controls, which target object event makes this
 /// binding dependency copy the target value to the <paramref name="sourceDd"/> data descriptor.
 /// If set to <see cref="UpdateSourceTrigger.PropertyChanged"/>, the new binding dependency object
 /// will automatically attach to property changes of the <paramref name="targetDd"/> data descriptor and
 /// reflect the changed value to the <paramref name="sourceDd"/> data descriptor. If set to
 /// <see cref="UpdateSourceTrigger.LostFocus"/>, the new binding dependency will attach to the
 /// <see cref="UIElement.EventOccured"/> event of the <paramref name="parentUiElement"/> object.
 /// If set to <see cref="UpdateSourceTrigger.Explicit"/>, the new binding dependency won't attach to
 /// the target at all.</param>
 /// <param name="parentUiElement">The parent <see cref="UIElement"/> of the specified <paramref name="targetDd"/>
 /// data descriptor. This parameter is only used to attach to the lost focus event if
 /// <paramref name="updateSourceTrigger"/> is set to <see cref="UpdateSourceTrigger.LostFocus"/>.</param>
 /// <param name="customValueConverter">Set a custom value converter with this parameter. If this parameter
 /// is set to <c>null</c>, the default <see cref="TypeConverter"/> will be used.</param>
 /// <param name="customValueConverterParameter">Parameter to be used in the custom value converter, if one is
 /// set.</param>
 public BindingDependency(IDataDescriptor sourceDd, IDataDescriptor targetDd, bool autoAttachToSource,
     UpdateSourceTrigger updateSourceTrigger, UIElement parentUiElement,
     IValueConverter customValueConverter, object customValueConverterParameter)
 {
   _sourceDd = sourceDd;
   _targetDd = targetDd;
   _targetObject = _targetDd.TargetObject as DependencyObject;
   _sourceObject = _sourceDd.TargetObject as DependencyObject;
   _valueConverter = customValueConverter;
   _converterParameter = customValueConverterParameter;
   if (autoAttachToSource && sourceDd.SupportsChangeNotification)
   {
     sourceDd.Attach(OnSourceChanged);
     _attachedToSource = true;
   }
   if (targetDd.SupportsChangeNotification)
   {
     if (updateSourceTrigger == UpdateSourceTrigger.PropertyChanged)
     {
       targetDd.Attach(OnTargetChanged);
       _attachedToTarget = true;
     }
     else if (updateSourceTrigger == UpdateSourceTrigger.LostFocus)
     {
       if (parentUiElement != null)
         parentUiElement.EventOccured += OnTargetElementEventOccured;
       _attachedToLostFocus = parentUiElement;
     }
   }
   // Initially update endpoints
   if (autoAttachToSource)
     UpdateTarget();
   if (updateSourceTrigger != UpdateSourceTrigger.Explicit &&
       !autoAttachToSource) // If we are attached to both, only update one direction
     UpdateSource();
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:60,代码来源:BindingDependency.cs


示例3: BringIntoView

 protected virtual void BringIntoView(UIElement element, ref RectangleF elementBounds)
 {
   if (_doScroll)
   {
     IList<FrameworkElement> visibleChildren = GetVisibleChildren();
     int index = 0;
     foreach (FrameworkElement currentChild in visibleChildren)
     {
       if (InVisualPath(currentChild, element))
       {
         int oldFirstVisibleChild = _actualFirstVisibleChildIndex;
         int oldLastVisibleChild = _actualLastVisibleChildIndex;
         bool first;
         if (index < oldFirstVisibleChild)
           first = true;
         else if (index <= oldLastVisibleChild)
           // Already visible
           break;
         else
           first = false;
         SetScrollIndex(index, first);
         // Adjust the scrolled element's bounds; Calculate the difference between positions of childen at old/new child indices
         float extendsInOrientationDirection = (float) SumActualExtendsInOrientationDirection(visibleChildren, Orientation,
             first ? oldFirstVisibleChild : oldLastVisibleChild, index);
         if (Orientation == Orientation.Horizontal)
           elementBounds.X -= extendsInOrientationDirection;
         else
           elementBounds.Y -= extendsInOrientationDirection;
         break;
       }
       index++;
     }
   }
 }
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:34,代码来源:StackPanel.cs


示例4: AttachToObject

 public void AttachToObject(UIElement targetObject)
 {
   _targetObject = targetObject;
   targetObject.EventOccured += OnUIEventOccured;
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:5,代码来源:WorkflowSaveRestoreStateAction.cs


示例5: GetContext

 protected AnimationContext GetContext(Timeline line, UIElement element)
 {
   lock (_syncObject)
     return _scheduledAnimations.FirstOrDefault(context => context.Timeline == line && context.TimelineContext.VisualParent == element);
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:5,代码来源:Animator.cs


示例6: StopStoryboard

 /// <summary>
 /// Stops the specified <paramref name="board"/> which runs in the context of the
 /// given <paramref name="element"/>.
 /// </summary>
 /// <param name="board">The storyboard to stop.</param>
 /// <param name="element">Context element on which the <paramref name="board"/> runs.</param>
 public void StopStoryboard(Storyboard board, UIElement element)
 {
   lock (_syncObject)
   {
     AnimationContext context = GetContext(board, element);
     if (context == null) return;
     ResetAllValues(context);
     _scheduledAnimations.Remove(context);
   }
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:16,代码来源:Animator.cs


示例7: InVisualPath

 public static bool InVisualPath(UIElement possibleParent, UIElement child)
 {
   Visual current = child;
   while (current != null)
     if (ReferenceEquals(possibleParent, current))
       return true;
     else
       current = current.VisualParent;
   return false;
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:10,代码来源:UIElement.cs


示例8: BringIntoView

 /// <summary>
 /// Will make this element scroll the specified <paramref name="element"/> in a visible
 /// position inside this element's borders. The call should also be delegated to the parent element
 /// with the original element and its updated bounds as parameter; this will make all parents also
 /// scroll their visible range.
 /// </summary>
 /// <remarks>
 /// This method will be overridden by classes which can scroll their content. Such a class
 /// will take two actions here:
 /// <list type="bullet">
 /// <item>Scroll the specified <paramref name="element"/> to a visible region inside its borders,
 /// while undoing layout transformations which will be applied to children. At the same time,
 /// the <paramref name="elementBounds"/> should be updated to the new bounds after scrolling.</item>
 /// <item>Call this inherited method (in <see cref="UIElement"/>), which delegates the call to
 /// the visual parent.</item>
 /// </list>
 /// The call to the visual parent should use the same <paramref name="element"/> but an updated
 /// <paramref name="elementBounds"/> rectangle. The <paramref name="elementBounds"/> parameter
 /// should reflect the updated element's bounds after the scrolling update has taken place in the
 /// next layout cycle.
 /// </remarks>
 /// <param name="element">The original element which should be made visible.</param>
 /// <param name="elementBounds">The element's bounds which will be active after the scrolling
 /// update.</param>
 public virtual void BringIntoView(UIElement element, RectangleF elementBounds)
 {
   UIElement parent = VisualParent as UIElement;
   if (parent != null)
     parent.BringIntoView(element, elementBounds);
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:30,代码来源:UIElement.cs


示例9: BringIntoView

    public override void BringIntoView(UIElement element, RectangleF elementBounds)
    {
      if (_doScroll || AutoCentering != ScrollAutoCenteringEnum.None)
      {
        float differenceX = 0;
        float differenceY = 0;

        if (IsHorzCentering)
          differenceX = CalculateCenteredScrollPos(elementBounds.X, elementBounds.Width, ActualPosition.X, ActualWidth);
        else if (_doScroll)
          differenceX = CalculateVisibleScrollDifference(elementBounds.X, elementBounds.Width, ActualPosition.X, ActualWidth); 

        if (IsVertCentering)
          differenceY = CalculateCenteredScrollPos(elementBounds.Y, elementBounds.Height, ActualPosition.Y, ActualHeight) - _actualScrollOffsetY;
        else if (_doScroll)
          differenceY = CalculateVisibleScrollDifference(elementBounds.Y, elementBounds.Height, ActualPosition.Y, ActualHeight);

        // Change rect as if children were already re-arranged
        elementBounds.X += differenceX;
        elementBounds.Y += differenceY;
        SetScrollOffset(_actualScrollOffsetX + differenceX, _actualScrollOffsetY + differenceY);
      }
      base.BringIntoView(element, elementBounds);
    }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:24,代码来源:ScrollContentPresenter.cs


示例10: Execute

 public void Execute(UIElement element)
 {
   element.ElementState = _state;
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:4,代码来源:FrameworkElement.cs


示例11: MakeChildVisible

    protected override void MakeChildVisible(UIElement element, ref RectangleF elementBounds)
    {
      IItemProvider itemProvider = ItemProvider;
      if (itemProvider == null)
      {
        base.MakeChildVisible(element, ref elementBounds);
        return;
      }

      if (_doScroll)
      {
        int lineIndex = 0;

        IList<FrameworkElement> arrangedItemsCopy;
        lock (Children.SyncRoot)
        {
          arrangedItemsCopy = new List<FrameworkElement>(_arrangedItems);
        }
        IList<LineMeasurement> lines = new List<LineMeasurement>(_arrangedLines);
        foreach (LineMeasurement line in lines)
        {
          for (int childIndex = line.StartIndex; childIndex <= line.EndIndex; childIndex++)
          {
            FrameworkElement currentChild = arrangedItemsCopy[childIndex];
            if (InVisualPath(currentChild, element))
            {
              int oldFirstVisibleLine = _actualFirstVisibleLineIndex;
              int oldLastVisibleLine = _actualLastVisibleLineIndex;
              bool first;
              if (lineIndex < oldFirstVisibleLine)
                first = true;
              else if (lineIndex <= oldLastVisibleLine)
                // Already visible
                break;
              else
                first = false;
              SetScrollIndex(lineIndex, first);
              // Adjust the scrolled element's bounds; Calculate the difference between positions of childen at old/new child indices
              float extendsInOrientationDirection = SumActualLineExtendsInNonOrientationDirection(lines,
                  first ? oldFirstVisibleLine : oldLastVisibleLine, lineIndex);
              if (Orientation == Orientation.Horizontal)
                elementBounds.X -= extendsInOrientationDirection;
              else
                elementBounds.Y -= extendsInOrientationDirection;
              break;
            }
          }
          lineIndex++;
        }
      }
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:51,代码来源:VirtualizingWrapPanel.cs


示例12: PropertyAnimationTimelineContext

 public PropertyAnimationTimelineContext(UIElement element)
   : base(element)
 { }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:3,代码来源:PropertyAnimationTimeline.cs


示例13: CreateTimelineContext

 public override TimelineContext CreateTimelineContext(UIElement element)
 {
   PropertyAnimationTimelineContext result = new PropertyAnimationTimelineContext(element)
     {DataDescriptor = GetDataDescriptor(element)};
   return result;
 }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:6,代码来源:PropertyAnimationTimeline.cs


示例14: GetDataDescriptor

 protected IDataDescriptor GetDataDescriptor(UIElement element)
 {
   string targetName = Storyboard.GetTargetName(this);
   object targetObject = null;
   if (targetName == null)
     targetObject = element;
   else
   {
     INameScope ns = element.FindNameScope();
     if (ns != null)
       targetObject = ns.FindName(targetName);
     if (targetObject == null)
       targetObject = element.FindElement(new NameMatcher(targetName));
     if (targetObject == null)
       return null;
   }
   try
   {
     IDataDescriptor result = new ValueDataDescriptor(targetObject);
     if (_propertyExpression != null && _propertyExpression.Evaluate(result, out result))
       return result;
   }
   catch (XamlBindingException e)
   {
     ServiceRegistration.Get<ILogger>().Warn("PropertyAnimationTimeline: Error evaluating expression '{0}' on target object '{1}'", e, _propertyExpression, targetObject);
   }
   return null;
 }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:28,代码来源:PropertyAnimationTimeline.cs


示例15: Match

 public bool Match(UIElement current)
 {
   return _name == current.Name;
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:4,代码来源:UIElement.cs


示例16: Execute

 public void Execute(UIElement element)
 {
   element.Screen = _screen;
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:4,代码来源:UIElement.cs


示例17: IsChildRenderedAt

 public override bool IsChildRenderedAt(UIElement child, float x, float y)
 {
   // The ScrollContentPresenter clips all rendering outside its range, so first check if x and y are in its area
   return IsInArea(x, y) && base.IsChildRenderedAt(child, x, y);
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:5,代码来源:ScrollContentPresenter.cs


示例18: IsChildRenderedAt

 /// <summary>
 /// Returns the information if the given child is rendered at the given position.
 /// Panels will check their children in the given render order.
 /// Controls, which clip their render output at their boundaries or which hide individual children
 /// will check if the given child is shown.
 /// Other controls, wich don't clip their children's render output, will simply return the return value
 /// of their parent's <see cref="IsChildRenderedAt"/> method with <c>this</c> as argument.
 /// </summary>
 /// <param name="child">Child to check.</param>
 /// <param name="x">Absolute X coordinate to check.</param>
 /// <param name="y">Absolute Y coordinate to check.</param>
 /// <returns><c>true</c> if the given child of this element is rendered.</returns>
 public virtual bool IsChildRenderedAt(UIElement child, float x, float y)
 {
   UIElement parent = VisualParent as UIElement;
   return parent == null ? true : parent.IsChildRenderedAt(this, x, y);
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:17,代码来源:UIElement.cs


示例19: BringIntoView

    protected override void BringIntoView(UIElement element, ref RectangleF elementBounds)
    {
      IItemProvider itemProvider = ItemProvider;
      if (itemProvider == null)
      {
        base.BringIntoView(element, elementBounds);
        return;
      }

      if (_doScroll)
      {
        IList<FrameworkElement> arrangedItemsCopy;
        int arrangedStart;
        int oldFirstViewableChild;
        int oldLastViewableChild;
        lock (Children.SyncRoot)
        {
          arrangedItemsCopy = new List<FrameworkElement>(_arrangedItems);
          arrangedStart = _arrangedItemsStartIndex;
          oldFirstViewableChild = _actualFirstVisibleChildIndex - arrangedStart;
          oldLastViewableChild = _actualLastVisibleChildIndex - arrangedStart;
        }
        if (arrangedStart < 0)
          return;
        int index = 0;
        foreach (FrameworkElement currentChild in arrangedItemsCopy)
        {
          if (InVisualPath(currentChild, element))
          {
            bool first;
            if (index < oldFirstViewableChild)
              first = true;
            else if (index <= oldLastViewableChild)
              // Already visible
              break;
            else
              first = false;
            SetScrollIndex(index + arrangedStart, first);
            // Adjust the scrolled element's bounds; Calculate the difference between positions of childen at old/new child indices
            float extendsInOrientationDirection = (float) SumActualExtendsInOrientationDirection(arrangedItemsCopy, Orientation,
                first ? oldFirstViewableChild : oldLastViewableChild, index);
            if (Orientation == Orientation.Horizontal)
              elementBounds.X -= extendsInOrientationDirection;
            else
              elementBounds.Y -= extendsInOrientationDirection;
            break;
          }
          index++;
        }
      }
    }
开发者ID:aspik,项目名称:MediaPortal-2,代码行数:51,代码来源:VirtualizingStackPanel.cs


示例20: StartStoryboard

    /// <summary>
    /// Starts the specified <paramref name="board"/> in the context of the specified
    /// <paramref name="element"/>.
    /// </summary>
    /// <remarks>
    /// Depending on the parameter <paramref name="handoffBehavior"/>, the new storyboard will
    /// be started when the last other storyboard, which occupies a conflicting property,
    /// has finished.
    /// </remarks>
    /// <param name="board">The storyboard to start.</param>
    /// <param name="element">Context element which will be used as
    /// <see cref="TimelineContext.VisualParent"/> for the new <paramref name="board"/>.</param>
    /// <param name="handoffBehavior">Controls how the new storyboard animation will be
    /// attached to already running animations, if there are conflicting properties animated
    /// by an already running anmiation an by the new <paramref name="board"/>.</param>
    public void StartStoryboard(Storyboard board, UIElement element,
        HandoffBehavior handoffBehavior)
    {
      lock (_syncObject)
      {
        AnimationContext context = new AnimationContext
          {
              Timeline = board,
              TimelineContext = board.CreateTimelineContext(element)
          };

        IDictionary<IDataDescriptor, object> conflictingProperties;
        ICollection<AnimationContext> conflictingAnimations;
        FindConflicts(context, out conflictingAnimations, out conflictingProperties);
        ExecuteHandoff(context, conflictingAnimations, handoffBehavior);

        try
        {
          board.Setup(context.TimelineContext, conflictingProperties);

          _scheduledAnimations.Add(context);
          board.Start(context.TimelineContext, SkinContext.SystemTickCount);
        }
        catch (Exception ex)
        {
          ServiceRegistration.Get<ILogger>().Error("Animator: Error initializing StoryBoard", ex);
        }

        // No animation here - has to be done in the Animate method
      }
    }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:46,代码来源:Animator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Rendering.RenderContext类代码示例发布时间:2022-05-26
下一篇:
C# Workflow.NavigationContext类代码示例发布时间: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