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


C# FrameworkElement.SetValue方法代码示例

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


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

示例1: 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

示例2: 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

示例3: ShowItem

 internal void ShowItem(ContainerContentChangingEventArgs args, FrameworkElement item)
 {
     item.SetValue(FrameworkElement.DataContextProperty, DependencyProperty.UnsetValue);
     item.Opacity = 1;
 }
开发者ID:kiwidev,项目名称:renderlib,代码行数:5,代码来源:Render.cs

示例4: HideItem

 internal void HideItem(FrameworkElement item)
 {
     item.SetValue(FrameworkElement.DataContextProperty, null);
     item.Opacity = 0;
 }
开发者ID:kiwidev,项目名称:renderlib,代码行数:5,代码来源:Render.cs

示例5: SetMargin

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

示例6: SetObservedHeight

 public static void SetObservedHeight(FrameworkElement frameworkElement, double observedHeight)
 {         
     frameworkElement.SetValue(ObservedHeightProperty, observedHeight);
 }
开发者ID:modulexcite,项目名称:Lumia-imaging-sdk,代码行数:4,代码来源:FrameworkElementAttachedProperties.cs

示例7: SetObserve

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

示例8: SetAttachedPopup

 /// <summary>
 /// 将一个 FullWindowPopup 附加到一个 FrameworkElement 上。
 /// </summary>
 /// <param name="obj">被附加的 FrameworkElement。</param>
 /// <param name="value">附加的 FullWindowPopup。</param>
 public static void SetAttachedPopup(FrameworkElement obj, FullWindowPopup value)
 {
     obj.SetValue(AttachedPopupProperty, value);
 }
开发者ID:h82258652,项目名称:SoftwareKobo.UniversalToolkit,代码行数:9,代码来源:FullWindowPopup.cs

示例9: SetContent

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

示例10: SetCommandParameter

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

示例11: SetEventArgsAsParameter

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

示例12: SetCommand

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

示例13: SetEvent

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

示例14: applyQuadrant

        private void applyQuadrant(FrameworkElement ctl, string qlocation, int width, int height, bool preSized = false)
        {
            Grid parent;
            int row;
            int col;
            string loc;
            Tuple<int, int> quad;

            parent = FindParentOrCreate(qlocation);

            // Now we will be able to add the new control to the right place.
            loc = qlocation.Substring(qlocation.Length - 1, 1);
            quad = TranslateQLoc(loc);
            row = quad.Item1;
            col = quad.Item2;

            if (width > 0 && !preSized)
                ctl.Width = width * ((IIFControl)ctl).WidthOfAChar;
            else if (!preSized)
                ctl.HorizontalAlignment = HorizontalAlignment.Stretch;

            if (height > 0 && !preSized)
                ctl.Height = height * ((IIFControl)ctl).HeightOfAChar;
            else if (!preSized)
                ctl.VerticalAlignment = VerticalAlignment.Stretch;

            ctl.Name = kCtlName + qlocation; // +"__" + parent.Children.Count;

            if (parent.Children.Count > 0)
            {
                var existing = parent.Children.FirstOrDefault(i => (int)i.GetValue(Grid.ColumnProperty) == col && (int)i.GetValue(Grid.RowProperty) == row);
                // Need to find an existing element that is in our spot
                if (existing is Grid)
                {
                    // tried to place where there is a grid.
                    // Try to place in exact spot in the grid we found
                    applyQuadrant(ctl, qlocation + qlocation.Substring(qlocation.Length - 1, 1), width, height, true);
                    return;
                }
                if (existing != null)
                {
                    var ctlNum = controls.IndexOf((FrameworkElement)existing);

                    splitCell(parent, ctlNum, ctl, "");
                    return;
                }
                // else fall through to insert

                //    moveControlToGrid((FrameworkElement)parent.Children[0]);
                //    var newparent = (Grid)parent.Children[0];

                //    newparent.Children.Add(ctl);
                //    ctl.SetValue(Grid.RowProperty, 1);
                //    ctl.SetValue(Grid.ColumnProperty, 0);
            }
            parent.Children.Add(ctl);
            ctl.SetValue(Grid.RowProperty, row);
            ctl.SetValue(Grid.ColumnProperty, col);
        }
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:59,代码来源:SimpleRuntime-Setup.cs

示例15: SetRegisterAsMediaService

 /// <summary>
 /// Sets value describing whether FrameworkElement is acting as View in MVVM.
 /// </summary>
 public static void SetRegisterAsMediaService(FrameworkElement target, bool value)
 {
     target.SetValue(RegisterAsMediaServiceProperty, value);
 }
开发者ID:uwe-e,项目名称:BSE.Tunes,代码行数:7,代码来源:PlayerService.cs


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