• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Primitives.ButtonBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Controls.Primitives.ButtonBase的典型用法代码示例。如果您正苦于以下问题:C# ButtonBase类的具体用法?C# ButtonBase怎么用?C# ButtonBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ButtonBase类属于System.Windows.Controls.Primitives命名空间,在下文中一共展示了ButtonBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: OnTargetButtonChanged

 public void OnTargetButtonChanged(ButtonBase button)
 {
     if (button != null)
     {
         button.Click += (s, e) => { this.IsOpen = true; };
         //UserControl window = TreeHelper.TryFindParent<UserControl>(button);
         //if (window == null)
         //{
         //    return;
         //}
         //window.PreviewMouseLeftButtonDown += (s, e) =>
         //{
         //    if (this.IsOpen && !this.IsMouseOver)
         //    {
         //        e.Handled = true;
         //        this.IsOpen = false;
         //    }
         //};
     }
 }
开发者ID:BoonieBear,项目名称:TinyMetro,代码行数:20,代码来源:MetroPopup.cs


示例17: OnApplyTemplate

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

            FirstButton = (ButtonBase)GetTemplateChild("FirstButton");
            PreviousButton = (ButtonBase)GetTemplateChild("PreviousButton");
            NextButton = (ButtonBase)GetTemplateChild("NextButton");
            LastButton = (ButtonBase)GetTemplateChild("LastButton");
            AddButton = (ButtonBase)GetTemplateChild("AddButton");
            DeleteButton = (ButtonBase)GetTemplateChild("DeleteButton");
            CurrentPositionTextBox = (TextBox)GetTemplateChild("CurrentPositionTextBox");
            ItemCountTextBlock = (TextBlock)GetTemplateChild("ItemCountTextBlock");

            // ReSharper disable PossibleNullReferenceException
            FirstButton.Click += delegate { CurrentPosition = 1; };
            PreviousButton.Click += delegate { CurrentPosition--; };
            NextButton.Click += delegate { CurrentPosition++; };
            LastButton.Click += delegate { CurrentPosition = ItemsSource.Count; };
            DeleteButton.Click += DeleteButton_Click;
            AddButton.Click += AddButton_Click;
            // ReSharper restore PossibleNullReferenceException
        }
开发者ID:Rashed-Hoque,项目名称:IdSharp,代码行数:22,代码来源:CollectionNavigator.cs


示例18: SetCommandParameter

 public static void SetCommandParameter(ButtonBase buttonBase, object parameter)
 {
     if (buttonBase == null) throw new System.ArgumentNullException("buttonBase");
     buttonBase.SetValue(CommandParameterProperty, parameter);
 }
开发者ID:nick121212,项目名称:xima_desktop3,代码行数:5,代码来源:Click.cs


示例19: SetCommand

        /// <summary>
        /// Sets the name of the command associated with the specified Button.
        /// </summary>
        /// <param name="button">The Button to associate the command with.</param>
        /// <param name="commandName">The name of the command to associated.</param>
        public static void SetCommand(ButtonBase button, string commandName)
        {
            BehaviorCollection behaviors = GetBehaviors(button);
            foreach (Behavior behavior in behaviors) {
                CommandBehavior commandBehavior = behavior as CommandBehavior;
                if (commandBehavior != null) {
                    if (String.IsNullOrEmpty(commandName)) {
                        behaviors.Remove(commandBehavior);
                    }
                    else {
                        commandBehavior.CommandName = commandName;
                    }
                    return;
                }
            }

            if (String.IsNullOrEmpty(commandName) == false) {
                CommandBehavior commandBehavior = new CommandBehavior();
                commandBehavior.CommandName = commandName;

                behaviors.Add(commandBehavior);
            }
        }
开发者ID:nikhilk,项目名称:silverlightfx,代码行数:28,代码来源:Interaction.cs


示例20: SetAction

        /// <summary>
        /// Sets the action associated with the specified Button.
        /// </summary>
        /// <param name="button">The Button to associate the action with.</param>
        /// <param name="action">The action to associate with the button.</param>
        public static void SetAction(ButtonBase button, TriggerAction action)
        {
            if (action == null) {
                return;
            }

            TriggerCollection triggers = GetTriggers(button);

            foreach (Trigger trigger in triggers) {
                ClickTrigger clickTrigger = trigger as ClickTrigger;
                clickTrigger.Action = action;
            }

            ClickTrigger newTrigger = new ClickTrigger();
            newTrigger.Action = action;

            triggers.Add(newTrigger);
        }
开发者ID:nikhilk,项目名称:silverlightfx,代码行数:23,代码来源:Interaction.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Primitives.DragCompletedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Charting.Chart类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap