當前位置: 首頁>>代碼示例>>C#>>正文


C# Primitives.ButtonBase類代碼示例

本文整理匯總了C#中System.Windows.Controls.Primitives.ButtonBase的典型用法代碼示例。如果您正苦於以下問題:C# ButtonBase類的具體用法?C# ButtonBase怎麽用?C# ButtonBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ButtonBase類屬於System.Windows.Controls.Primitives命名空間,在下文中一共展示了ButtonBase類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadOnlyProperties

		static public void ReadOnlyProperties (ButtonBase bb)
		{
			Assert.IsFalse ((bool) bb.GetValue (ButtonBase.IsFocusedProperty), "Get/IsFocusedProperty");
			Assert.IsFalse ((bool) bb.GetValue (ButtonBase.IsMouseOverProperty), "Get/IsMouseOverProperty");
			Assert.IsFalse ((bool) bb.GetValue (ButtonBase.IsPressedProperty), "Get/IsPressedProperty");

			Assert.Throws<InvalidOperationException> (delegate {
				bb.SetValue (ButtonBase.IsFocusedProperty, true);
			});
			Assert.IsFalse (bb.IsFocused, "IsFocused");

			Assert.Throws<InvalidOperationException> (delegate {
				bb.SetValue (ButtonBase.IsMouseOverProperty, true);
			});
			Assert.IsFalse (bb.IsMouseOver, "IsMouseOver");

			Assert.Throws<InvalidOperationException> (delegate {
				bb.SetValue (ButtonBase.IsPressedProperty, true);
			});
			Assert.IsFalse (bb.IsPressed, "IsPressed");

			bb.ClearValue (ButtonBase.IsFocusedProperty);
			bb.ClearValue (ButtonBase.IsMouseOverProperty);
			bb.ClearValue (ButtonBase.IsPressedProperty);
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:25,代碼來源:ButtonBaseTest.cs

示例2: ButtonBaseAutomationPeer

		protected ButtonBaseAutomationPeer (ButtonBase owner)
			: base (owner)
		{
			textBlock = owner.Content as TextBlock;
			if (textBlock != null)
				textBlock.UIATextChanged += TextBlock_TextChanged;
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:7,代碼來源:ButtonBaseAutomationPeer.cs

示例3: ButtonBackend

        protected ButtonBackend(ButtonBase impl)
        {
            if (impl == null)
                throw new ArgumentNullException ("impl");

            Widget = impl;
        }
開發者ID:akrisiun,項目名稱:xwt,代碼行數:7,代碼來源:ButtonBackend.cs

示例4: SetConfigData

 /// <summary>
 /// Sets the value of the ConfigData attached property to a specified ButtonBase.
 /// </summary>
 /// <param name="element">The ButtonBase to which the attached property is written.</param>
 /// <param name="value">The needed ConfigData value.</param>
 public static void SetConfigData(ButtonBase element, string value)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(ConfigDataProperty, value);
 }
開發者ID:Esri,項目名稱:arcgis-viewer-silverlight,代碼行數:13,代碼來源:ExtensionAttachedProperties.cs

示例5: AddButtonToMap

        internal void AddButtonToMap(ButtonBase btn, ICommand cmd)
        {
            if (!ContainsCommand(cmd))
                _map.Add(new WeakReference(cmd), new List<WeakReference>());

            List<WeakReference> weakRefs = GetButtonsFromCommand(cmd);
            weakRefs.Add(new WeakReference(btn));
        }
開發者ID:JimLynn,項目名稱:MessageCloud,代碼行數:8,代碼來源:CommandToButtonsMap.cs

示例6: GetConfigData

 /// <summary>
 /// Gets the value of the ConfigData attached property for a specified ButtonBase.
 /// </summary>
 /// <param name="element">The ButtonBase from which the property value is read.</param>
 /// <returns>The ConfigData property value for the ButtonBase.</returns>
 public static string GetConfigData(ButtonBase element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return element.GetValue(ConfigDataProperty) as string;
 }
開發者ID:Esri,項目名稱:arcgis-viewer-silverlight,代碼行數:13,代碼來源:ExtensionAttachedProperties.cs

示例7: AddButtonToMap

        internal void AddButtonToMap(ButtonBase button, ICommand comand)
        {
            if (!ContainsCommand(comand))
            {
                _map.Add(new WeakReference(comand), new List<WeakReference>());
            }

            var weakRefs = GetButtonsFromCommand(comand);
            weakRefs.Add(new WeakReference(button));
        }
開發者ID:ssickles,項目名稱:archive,代碼行數:10,代碼來源:CommandToButtonsMap.cs

示例8: GetOrCreateBehavior

 private static ButtonBaseClickCommandBehavior GetOrCreateBehavior(ButtonBase buttonBase)
 {
     var behavior = buttonBase.GetValue(clickCommandBehaviorProperty) as ButtonBaseClickCommandBehavior;
     if (behavior == null)
     {
         behavior = new ButtonBaseClickCommandBehavior(buttonBase);
         buttonBase.SetValue(clickCommandBehaviorProperty, behavior);
     }
     return behavior;
 }
開發者ID:philcockfield,項目名稱:Open.TestHarness.SL,代碼行數:10,代碼來源:Click.cs

示例9: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _textBox = GetTemplateChild(PART_TextBox) as TextBox;
            _button = GetTemplateChild(PART_ButtonBase) as ButtonBase;

            if (_button != null)
            {
                _button.Click += ButtonClick;
            }
        }
開發者ID:Robin--,項目名稱:Warewolf,代碼行數:12,代碼來源:FilterTextBox.cs

示例10: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            // Close Button
            ButtonBase oldCloseButton = _partCloseButton;
            _partCloseButton = Template.FindName("PART_CloseButton", this) as ButtonBase;

            if (!ReferenceEquals(oldCloseButton, _partCloseButton))
            {
                if (oldCloseButton != null)
                {
                    oldCloseButton.Click -= OnCloseButtonClick;
                }

                if (_partCloseButton != null)
                {
                    _partCloseButton.Click += OnCloseButtonClick;
                }
            }

            // Minimize Button
            ButtonBase oldMinimizeButton = _partMinimizeButton;
            _partMinimizeButton = Template.FindName("PART_MinimizeButton", this) as ButtonBase;

            if (!ReferenceEquals(oldMinimizeButton, _partMinimizeButton))
            {
                if (oldMinimizeButton != null)
                {
                    oldMinimizeButton.Click -= OnMinimizeButtonClick;
                }

                if (_partMinimizeButton != null)
                {
                    _partMinimizeButton.Click += OnMinimizeButtonClick;
                }
            }

            // Maximize Button
            ButtonBase oldMaximizeButton = _partMaximizeButton;
            _partMaximizeButton = Template.FindName("PART_MaximizeButton", this) as ButtonBase;

            if (!ReferenceEquals(oldMaximizeButton, _partMaximizeButton))
            {
                if (oldMaximizeButton != null)
                {
                    oldMaximizeButton.Click -= OnMaximizeButtonClick;
                }

                if (_partMaximizeButton != null)
                {
                    _partMaximizeButton.Click += OnMaximizeButtonClick;
                }
            }
        }
開發者ID:kristian-pettersen,項目名稱:torshify-r4dio,代碼行數:53,代碼來源:MetroWindow.cs

示例11: ButtonEventCheck

            public ButtonEventCheck(ButtonBase ButtonBase, bool showMessageBoxFlg)
            {
                RoutedEventHandler handler = (s, e) =>
                {
                    ButtonClickCalled = true;
                    if (showMessageBoxFlg)
                    {
                        MessageBox.Show("TestMessageWindow");
                    }
                };

                ButtonBase.Click += handler;
            }
開發者ID:Roommetro,項目名稱:Friendly.WPFStandardControls,代碼行數:13,代碼來源:WPFButtonBaseTest.cs

示例12: GetAction

        /// <summary>
        /// Gets the action associated with the specified Button.
        /// </summary>
        /// <param name="button">The Button to lookup.</param>
        /// <returns>The action associated with the Button; null if there is none.</returns>
        public static TriggerAction GetAction(ButtonBase button)
        {
            TriggerCollection triggers = (TriggerCollection)button.GetValue(TriggersProperty);
            if (triggers != null) {
                foreach (Trigger trigger in triggers) {
                    ClickTrigger clickTrigger = trigger as ClickTrigger;
                    if (clickTrigger != null) {
                        return clickTrigger.Action;
                    }
                }
            }

            return null;
        }
開發者ID:nikhilk,項目名稱:silverlightfx,代碼行數:19,代碼來源:Interaction.cs

示例13: RemoveButtonFromMap

        internal void RemoveButtonFromMap(ButtonBase btn, ICommand cmd)
        {
            List<WeakReference> buttonRefs = this.GetButtonsFromCommand(cmd);
            if (buttonRefs == null)
                return;

            for (int i = buttonRefs.Count - 1; i > -1; --i)
            {
                WeakReference weakRef = buttonRefs[i];
                if (weakRef.Target == btn)
                {
                    buttonRefs.RemoveAt(i);
                    break;
                }
            }
        }
開發者ID:JimLynn,項目名稱:MessageCloud,代碼行數:16,代碼來源:CommandToButtonsMap.cs

示例14: RemoveButtonFromMap

        internal void RemoveButtonFromMap(ButtonBase button, ICommand command)
        {
            var buttonRefs = GetButtonsFromCommand(command);
            if (buttonRefs == null)
            {
                return;
            }

            for (var i = buttonRefs.Count - 1; i > -1; --i)
            {
                var weakRef = buttonRefs[i];
                if (weakRef.Target == button)
                {
                    buttonRefs.RemoveAt(i);
                    break;
                }
            }
        }
開發者ID:ssickles,項目名稱:archive,代碼行數:18,代碼來源:CommandToButtonsMap.cs

示例15: OnApplyTemplate

        //--------------------------------------------------------------
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal
        /// processes call <see cref="FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            // Clean up.
            if (_button != null)
            {
                _button.Click -= OnButtonClick;
                _button = null;
            }

            base.OnApplyTemplate();

            // Find new button and install event handler.
            _button = GetTemplateChild("PART_Button") as ButtonBase;
            if (_button != null)
            {
                _button.Click += OnButtonClick;
            }
        }
開發者ID:Zolniu,項目名稱:DigitalRune,代碼行數:23,代碼來源:ColorButton.cs


注:本文中的System.Windows.Controls.Primitives.ButtonBase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。