本文整理汇总了C#中MediaPortal.UI.SkinEngine.Controls.Visuals.UIElement类的典型用法代码示例。如果您正苦于以下问题:C# UIElement类的具体用法?C# UIElement怎么用?C# UIElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIElement类属于MediaPortal.UI.SkinEngine.Controls.Visuals命名空间,在下文中一共展示了UIElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbstractTextInputHandler
protected AbstractTextInputHandler(UIElement parentElement, SimplePropertyDataDescriptor textDataDescriptor,
SimplePropertyDataDescriptor caretIndexDataDescriptor)
{
_parentElement = parentElement;
_textDataDescriptor = textDataDescriptor;
_caretIndexDataDescriptor = caretIndexDataDescriptor;
}
示例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();
}
示例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++;
}
}
}
示例4: AttachToObject
public void AttachToObject(UIElement targetObject)
{
_targetObject = targetObject;
targetObject.EventOccured += OnUIEventOccured;
}
示例5: GetContext
protected AnimationContext GetContext(Timeline line, UIElement element)
{
lock (_syncObject)
return _scheduledAnimations.FirstOrDefault(context => context.Timeline == line && context.TimelineContext.VisualParent == element);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例10: Execute
public void Execute(UIElement element)
{
element.ElementState = _state;
}
示例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++;
}
}
}
示例12: PropertyAnimationTimelineContext
public PropertyAnimationTimelineContext(UIElement element)
: base(element)
{ }
示例13: CreateTimelineContext
public override TimelineContext CreateTimelineContext(UIElement element)
{
PropertyAnimationTimelineContext result = new PropertyAnimationTimelineContext(element)
{DataDescriptor = GetDataDescriptor(element)};
return result;
}
示例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;
}
示例15: Match
public bool Match(UIElement current)
{
return _name == current.Name;
}