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


C# FrameworkElement.GetValue方法代码示例

本文整理汇总了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);
 }
开发者ID:modulexcite,项目名称:VisualDesigner,代码行数:8,代码来源:SetterValueBindingHelper.cs

示例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;
 }
开发者ID:AmrReda,项目名称:Windows.UI.Interactivity,代码行数:18,代码来源:Interaction.cs

示例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;
        }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:49,代码来源:MvxMvvmCrossBindingCreator.cs

示例4: GetLoadedCommand

 public static ICommand GetLoadedCommand(FrameworkElement frameworkElement)
 {
     return (ICommand)frameworkElement.GetValue(LoadedCommandProperty);
 }
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:4,代码来源:FrameworkElementAttachedProperties.cs

示例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;
        }
开发者ID:siatwangmin,项目名称:WinRTXamlToolkit,代码行数:82,代码来源:DependencyPropertyAnimationHelper.cs

示例6: GetAttachedPopup

 public static FullWindowPopup GetAttachedPopup(FrameworkElement obj)
 {
     return (FullWindowPopup)obj.GetValue(AttachedPopupProperty);
 }
开发者ID:h82258652,项目名称:SoftwareKobo.UniversalToolkit,代码行数:4,代码来源:FullWindowPopup.cs

示例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);
 }
开发者ID:uwe-e,项目名称:BSE.Tunes,代码行数:7,代码来源:PlayerService.cs

示例8: GetMargin

 public static Thickness GetMargin(FrameworkElement target) {
     return (Thickness)target.GetValue(MarginProperty);
 }
开发者ID:gruan01,项目名称:Lagou.UWP,代码行数:3,代码来源:UniMargin.cs

示例9: GetContent

 public static object GetContent(FrameworkElement d) {
     return d.GetValue(ContentProperty);
 }
开发者ID:gruan01,项目名称:Lagou.UWP,代码行数:3,代码来源:TopHeader.cs

示例10: GetEventArgsAsParameter

 public static bool GetEventArgsAsParameter(FrameworkElement target) {
     return (bool)target.GetValue(EventArgsAsParameterProperty);
 }
开发者ID:gruan01,项目名称:Lagou.UWP,代码行数:3,代码来源:EventCommand.cs

示例11: GetCommandParameter

 public static object GetCommandParameter(FrameworkElement target) {
     return (object)target.GetValue(CommandParameterProperty);
 }
开发者ID:gruan01,项目名称:Lagou.UWP,代码行数:3,代码来源:EventCommand.cs

示例12: GetCommand

 public static ICommand GetCommand(FrameworkElement target) {
     return (ICommand)target.GetValue(CommandProperty);
 }
开发者ID:gruan01,项目名称:Lagou.UWP,代码行数:3,代码来源:EventCommand.cs

示例13: GetEvent

 public static string GetEvent(FrameworkElement target) {
     return (string)target.GetValue(EventProperty);
 }
开发者ID:gruan01,项目名称:Lagou.UWP,代码行数:3,代码来源:EventCommand.cs

示例14: GetObserve

 public static bool GetObserve(FrameworkElement frameworkElement)
 {
     return (bool)frameworkElement.GetValue(ObserveProperty);
 }
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:4,代码来源:FrameworkElementAttachedProperties.cs

示例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);
                    }
                }
            }
        }
开发者ID:xperiandri,项目名称:Xaml.Interactions,代码行数:41,代码来源:ExtendedVisualStateManager.cs


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