コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Commands.cs プロジェクト: richardhopton/Meridian
        private static void UnhookCommand(ButtonBase element, ICommand command)
        {
            var behavior = (CommandButtonBehavior)element.GetValue(CommandButtonBehaviorProperty);

            behavior.Dettach();
            element.ClearValue(CommandButtonBehaviorProperty);
        }
コード例 #3
0
 /// <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;
 }
コード例 #4
0
ファイル: Click.cs プロジェクト: cointoss1973/Prism4.1-WPF
 public static object GetCommandParameter(ButtonBase buttonBase)
 {
     if (buttonBase == null)
     {
         throw new System.ArgumentNullException("buttonBase");
     }
     return(buttonBase.GetValue(CommandParameterProperty));
 }
コード例 #5
0
ファイル: Click.cs プロジェクト: cointoss1973/Prism4.1-WPF
 public static ICommand GetCommand(ButtonBase buttonBase)
 {
     if (buttonBase == null)
     {
         throw new System.ArgumentNullException("buttonBase");
     }
     return(buttonBase.GetValue(CommandProperty) as ICommand);
 }
コード例 #6
0
ファイル: Click.cs プロジェクト: ARLM-Keller/Daisy-Tobi-App
        private static ButtonBaseClickCommandBehavior GetOrCreateBehavior(ButtonBase buttonBase)
        {
            ButtonBaseClickCommandBehavior behavior = buttonBase.GetValue(ClickCommandBehaviorProperty) as ButtonBaseClickCommandBehavior;

            if (behavior == null)
            {
                behavior = new ButtonBaseClickCommandBehavior(buttonBase);
                buttonBase.SetValue(ClickCommandBehaviorProperty, behavior);
            }

            return(behavior);
        }
コード例 #7
0
        private static ClickedBehavior GetOrCreateBehavior(ButtonBase element)
        {
            var behavior = element.GetValue(ClickedBehaviorProperty) as ClickedBehavior;

            if (behavior == null)
            {
                behavior = new ClickedBehavior(element);
                element.SetValue(ClickedBehaviorProperty, behavior);
            }

            return(behavior);
        }
コード例 #8
0
        /// <summary>
        /// Gets the command name associated with the specified Button.
        /// </summary>
        /// <param name="button">The Button to lookup.</param>
        /// <returns>The command name associated with the Button; null if there is none.</returns>
        public static string GetCommand(ButtonBase button)
        {
            BehaviorCollection behaviors = (BehaviorCollection)button.GetValue(BehaviorsProperty);

            if (behaviors != null)
            {
                foreach (Behavior behavior in behaviors)
                {
                    Command commandBehavior = behavior as Command;
                    if (commandBehavior != null)
                    {
                        return(commandBehavior.CommandName);
                    }
                }
            }

            return(null);
        }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
        protected override string GetNameCore()
        {
            ButtonBase buttonBase = Owner as ButtonBase;

            // Only when Content is TextBlock TextBlock.Name is returned
            string name = buttonBase.Content as string;

            if (name == null)
            {
                TextBlock textblock = buttonBase.Content as TextBlock;
                if (textblock == null)
                {
                    name = string.Empty;
                }
                else
                {
                    AutomationPeer peer
                         = FrameworkElementAutomationPeer.CreatePeerForElement(textblock);
                    name = peer.GetName();
                }
            }

            return(buttonBase.GetValue(AutomationProperties.NameProperty) as string ?? name);
        }
コード例 #11
0
 public static bool GetIsIndeterminate(ButtonBase element) => (bool)element.GetValue(IsIndeterminateProperty);
コード例 #12
0
 public static Brush GetIndicatorBackground(ButtonBase element) => (Brush)element.GetValue(IndicatorBackgroundProperty);
コード例 #13
0
 public static string GetButtonName(ButtonBase button)
 => (string)button.GetValue(ButtonNameProperty);
コード例 #14
0
ファイル: Icon.cs プロジェクト: waleswood/Gu.Wpf.Media
 public static Geometry GetGeometry(this ButtonBase element)
 {
     return((Geometry)element.GetValue(GeometryProperty));
 }
コード例 #15
0
 public static DialogButton GetButtonResult(ButtonBase d)
 {
     return((DialogButton)d.GetValue(ButtonResultProperty));
 }
コード例 #16
0
 public static string GetStateControl(ButtonBase button)
 => (string)button.GetValue(StateControlProperty);
コード例 #17
0
 public static ShortcutName GetClick(ButtonBase attached)
 {
     return((ShortcutName)attached.GetValue(ClickProperty));
 }
コード例 #18
0
 public static bool GetIsIndicatorVisible(ButtonBase element) => (bool)element.GetValue(IsIndicatorVisibleProperty);
コード例 #19
0
 public static double GetOpacity(ButtonBase element) => (double)element.GetValue(OpacityProperty);
コード例 #20
0
 public static object GetCommandParameter(ButtonBase button)
 {
     return(button.GetValue(CommandParameterProperty));
 }
コード例 #21
0
 public static FlyoutControl GetFlyout(ButtonBase button)
 => (FlyoutControl)button.GetValue(FlyoutProperty);
コード例 #22
0
 public static bool GetInvokeCommandOnFirstLoad(ButtonBase btn)
 {
     return((bool)btn.GetValue(InvokeCommandOnFirstLoadProperty));
 }
コード例 #23
0
 public static ButtonColorScheme GetScheme(ButtonBase obj)
 => (ButtonColorScheme)obj.GetValue(SchemeProperty);
コード例 #24
0
 public static double GetValue(ButtonBase element) => (double)element.GetValue(ValueProperty);
コード例 #25
0
ファイル: Click.cs プロジェクト: ARLM-Keller/Daisy-Tobi-App
 public static ICommand GetCommand(ButtonBase buttonBase)
 {
     return(buttonBase.GetValue(CommandProperty) as ICommand);
 }
コード例 #26
0
 public static string GetVisualState(ButtonBase frameworkElement)
 => (string)frameworkElement.GetValue(VisualStateProperty);
コード例 #27
0
 public static ICommand GetCommand(ButtonBase button)
 {
     return((ICommand)button.GetValue(CommandProperty));
 }
コード例 #28
0
 public static UIElement GetTarget(ButtonBase b) => (UIElement)b.GetValue(TargetProperty);
コード例 #29
0
 public static object GetCommandParameter(ButtonBase target) => target.GetValue(CommandParameterProperty);
コード例 #30
0
ファイル: Commands.cs プロジェクト: richardhopton/Meridian
 private void SetIsEnabled(ButtonBase element)
 {
     element.IsEnabled = command.CanExecute(element.GetValue(Commands.CommandParameterProperty));
 }