当前位置: 首页>>代码示例>>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;未经允许,请勿转载。