本文整理汇总了C#中Windows.UI.Xaml.FrameworkElement.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.GetValue方法的具体用法?C# FrameworkElement.GetValue怎么用?C# FrameworkElement.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertyBinding
public static SetterValueBindingHelper GetPropertyBinding(FrameworkElement element)
{
if (null == element)
{
throw new ArgumentNullException("element");
}
return (SetterValueBindingHelper)element.GetValue(PropertyBindingProperty);
}
示例2: GetBehaviors
/// <summary>
/// Gets the <see cref="T:System.Windows.Interactivity.BehaviorCollection"/> associated with a specified object.
///
/// </summary>
/// <param name="obj">The object from which to retrieve the <see cref="T:System.Windows.Interactivity.BehaviorCollection"/>.</param>
/// <returns>
/// A <see cref="T:System.Windows.Interactivity.BehaviorCollection"/> containing the behaviors associated with the specified object.
/// </returns>
public static BehaviorCollection GetBehaviors(FrameworkElement obj)
{
BehaviorCollection behaviorCollection = (BehaviorCollection)obj.GetValue(Interaction.BehaviorsProperty);
if (behaviorCollection == null)
{
behaviorCollection = new BehaviorCollection();
obj.SetValue(Interaction.BehaviorsProperty, behaviorCollection);
}
return behaviorCollection;
}
示例3: GetOrCreateBindingsList
private IList<IMvxUpdateableBinding> GetOrCreateBindingsList(FrameworkElement attachedObject)
{
var existing = attachedObject.GetValue(BindingsListProperty) as IList<IMvxUpdateableBinding>;
if (existing != null)
return existing;
// attach the list
var newList = new List<IMvxUpdateableBinding>();
attachedObject.SetValue(BindingsListProperty, newList);
// create a binding watcher for the list
#if WINDOWS_WPF
var binding = new System.Windows.Data.Binding();
#endif
#if WINDOWS_COMMON
var binding = new Windows.UI.Xaml.Data.Binding();
#endif
bool attached = false;
Action attachAction = () =>
{
if (attached)
return;
BindingOperations.SetBinding(attachedObject, DataContextWatcherProperty, binding);
attached = true;
};
Action detachAction = () =>
{
if (!attached)
return;
#if WINDOWS_COMMON
attachedObject.ClearValue(DataContextWatcherProperty);
#else
BindingOperations.ClearBinding(attachedObject, DataContextWatcherProperty);
#endif
attached = false;
};
attachAction();
attachedObject.Loaded += (o, args) =>
{
attachAction();
};
attachedObject.Unloaded += (o, args) =>
{
detachAction();
};
return newList;
}
示例4: GetLoadedCommand
public static ICommand GetLoadedCommand(FrameworkElement frameworkElement)
{
return (ICommand)frameworkElement.GetValue(LoadedCommandProperty);
}
示例5: CreateStoryboard
private static Storyboard CreateStoryboard(
FrameworkElement target,
DependencyProperty animatingDependencyProperty,
string propertyPath,
ref object toValue,
TimeSpan durationTimeSpan,
EasingFunctionBase easingFunction)
{
object fromValue = target.GetValue(animatingDependencyProperty);
double fromDoubleValue;
double toDoubleValue;
DateTime fromDateTime;
DateTime toDateTime;
Storyboard storyBoard = new Storyboard();
Storyboard.SetTarget(storyBoard, target);
Storyboard.SetTargetProperty(storyBoard, propertyPath);
if ((fromValue != null && toValue != null))
{
if (ValueHelper.TryConvert(fromValue, out fromDoubleValue) && ValueHelper.TryConvert(toValue, out toDoubleValue))
{
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.EnableDependentAnimation = true;
#if !NO_EASING_FUNCTIONS
doubleAnimation.EasingFunction = easingFunction;
#endif
doubleAnimation.Duration = durationTimeSpan;
doubleAnimation.To = ValueHelper.ToDouble(toValue);
toValue = doubleAnimation.To;
storyBoard.Children.Add(doubleAnimation);
}
else if (ValueHelper.TryConvert(fromValue, out fromDateTime) && ValueHelper.TryConvert(toValue, out toDateTime))
{
ObjectAnimationUsingKeyFrames keyFrameAnimation = new ObjectAnimationUsingKeyFrames();
keyFrameAnimation.EnableDependentAnimation = true;
keyFrameAnimation.Duration = durationTimeSpan;
long intervals = (long)(durationTimeSpan.TotalSeconds * KeyFramesPerSecond);
if (intervals < 2L)
{
intervals = 2L;
}
IEnumerable<TimeSpan> timeSpanIntervals =
ValueHelper.GetTimeSpanIntervalsInclusive(durationTimeSpan, intervals);
IEnumerable<DateTime> dateTimeIntervals =
ValueHelper.GetDateTimesBetweenInclusive(fromDateTime, toDateTime, intervals);
IEnumerable<DiscreteObjectKeyFrame> keyFrames =
EnumerableFunctions.Zip(
dateTimeIntervals,
timeSpanIntervals,
(dateTime, timeSpan) => new DiscreteObjectKeyFrame() { Value = dateTime, KeyTime = timeSpan });
foreach (DiscreteObjectKeyFrame keyFrame in keyFrames)
{
keyFrameAnimation.KeyFrames.Add(keyFrame);
toValue = keyFrame.Value;
}
storyBoard.Children.Add(keyFrameAnimation);
}
}
if (storyBoard.Children.Count == 0)
{
ObjectAnimationUsingKeyFrames keyFrameAnimation = new ObjectAnimationUsingKeyFrames();
keyFrameAnimation.EnableDependentAnimation = true;
DiscreteObjectKeyFrame endFrame = new DiscreteObjectKeyFrame() { Value = toValue, KeyTime = new TimeSpan(0, 0, 0) };
keyFrameAnimation.KeyFrames.Add(endFrame);
storyBoard.Children.Add(keyFrameAnimation);
}
return storyBoard;
}
示例6: GetAttachedPopup
public static FullWindowPopup GetAttachedPopup(FrameworkElement obj)
{
return (FullWindowPopup)obj.GetValue(AttachedPopupProperty);
}
示例7: GetRegisterAsMediaService
/// <summary>
/// Gets value describing whether FrameworkElement is acting as View in MVVM.
/// </summary>
public static bool GetRegisterAsMediaService(FrameworkElement target)
{
return (bool)target.GetValue(RegisterAsMediaServiceProperty);
}
示例8: GetMargin
public static Thickness GetMargin(FrameworkElement target) {
return (Thickness)target.GetValue(MarginProperty);
}
示例9: GetContent
public static object GetContent(FrameworkElement d) {
return d.GetValue(ContentProperty);
}
示例10: GetEventArgsAsParameter
public static bool GetEventArgsAsParameter(FrameworkElement target) {
return (bool)target.GetValue(EventArgsAsParameterProperty);
}
示例11: GetCommandParameter
public static object GetCommandParameter(FrameworkElement target) {
return (object)target.GetValue(CommandParameterProperty);
}
示例12: GetCommand
public static ICommand GetCommand(FrameworkElement target) {
return (ICommand)target.GetValue(CommandProperty);
}
示例13: GetEvent
public static string GetEvent(FrameworkElement target) {
return (string)target.GetValue(EventProperty);
}
示例14: GetObserve
public static bool GetObserve(FrameworkElement frameworkElement)
{
return (bool)frameworkElement.GetValue(ObserveProperty);
}
示例15: CopyLayoutProperties
/// <summary>
/// Copy the layout properties from the source element to the target element, clearing them from the source.
/// </summary>
/// <param name="source">The source of the layout properties</param>
/// <param name="target">The destination of the layout properties</param>
private static void CopyLayoutProperties(FrameworkElement source, FrameworkElement target, bool restoring)
{
WrapperCanvas canvas = (restoring ? ((WrapperCanvas)source) : ((WrapperCanvas)target)) as WrapperCanvas;
if (canvas.LocalValueCache == null)
canvas.LocalValueCache = new Dictionary<DependencyProperty, object>();
foreach (DependencyProperty property in LayoutProperties)
{
if (!ChildAffectingLayoutProperties.Contains(property))
{
object actualValue = CacheActualValueHelper(source, property);
object localValue = CacheLocalValueHelper(source, property);
if (actualValue != localValue)
return;
if (restoring)
{
ReplaceCachedLocalValueHelper(target, property, canvas.LocalValueCache[property]);
}
else
{
object targetValue = target.GetValue(property);
canvas.LocalValueCache[property] = localValue;
if (IsVisibilityProperty(property))
{
canvas.DestinationVisibilityCache = (Visibility)source.GetValue(property);
}
else
{
target.SetValue(property, source.GetValue(property));
}
source.SetValue(property, targetValue);
}
}
}
}