當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。