public void can_attach_a_message_handler_to_a_ui_element_without_data_context() { var dp = new Button(); var handler = Mock<IRoutedMessageHandler>(); _controller.AddHandler( dp, handler, false ); var node = dp.GetValue(DefaultRoutedMessageController.NodeProperty) as InteractionNode; Assert.That(node, Is.Not.Null); Assert.That(node.MessageHandler, Is.EqualTo(handler)); Assert.That(dp.DataContext, Is.Null); }
public void can_attach_a_trigger_to_a_ui_element() { var dp = new Button(); var trigger = Mock<IMessageTrigger>(); trigger.Expect(x => x.Attach(Arg<InteractionNode>.Is.NotNull)); _controller.AttachTrigger( dp, trigger ); var node = dp.GetValue(DefaultRoutedMessageController.NodeProperty) as InteractionNode; Assert.That(node, Is.Not.Null); Assert.That(node.Triggers.Contains(trigger)); }
public void can_attach_a_message_handler_to_a_ui_element() { var dp = new Button(); var handler = Mock<IRoutedMessageHandler>(); handler.Expect(x => x.Unwrap()).Return(handler); handler.Expect(x => x.Initialize(Arg<IInteractionNode>.Is.NotNull)); _controller.AddHandler( dp, handler, true ); var node = dp.GetValue(DefaultRoutedMessageController.NodeProperty) as InteractionNode; Assert.That(node, Is.Not.Null); Assert.That(node.MessageHandler, Is.EqualTo(handler)); Assert.That(dp.DataContext, Is.EqualTo(handler)); }
private void registerPlayerMove(Button btn) { btn.FontSize = 30.0; btn.Content = "X"; int row = (int)btn.GetValue(Grid.RowProperty); int col = (int)btn.GetValue(Grid.ColumnProperty); Tuple<int, int> pickedCell = new Tuple<int, int>(row, col); usedCells.Add(pickedCell); }
public static Popup GetPopupToControl(Button button) { return (Popup) button.GetValue(PopupToControlProperty); }
public static PopupAction GetPopupAction(Button button) { return (PopupAction) button.GetValue(PopupActionProperty); }
public static bool? GetResult(Button button) { return (bool?)button.GetValue(ResultProperty); }
/// <summary> /// Gets ElementToFocusProperty /// </summary> /// <param name="button"></param> /// <returns></returns> public static Control GetElementToFocus(Button button) { return (Control)button.GetValue(ElementToFocusProperty); }
public static bool GetIsClearTextButtonBehaviorEnabled(Button d) { return (bool)d.GetValue(IsClearTextButtonBehaviorEnabledProperty); }
/// <summary> /// Gets the text box that on button click receives button's content string. /// </summary> /// <param name="button">Button whose property you're getting.</param> /// <returns>Text box that's receiving the content string of the button.</returns> public static TextBox GetTextBoxContentReceiver(Button button) { return (TextBox)button.GetValue(TextBoxContentReceiverProperty); }
/// <summary> /// Gets CharacterCase value of ExclusiveCase property for the specified button. /// </summary> /// <param name="button">Button whose ExclusiveCase property you're getting.</param> public static CharacterCase GetExclusiveCase(Button button) { return (CharacterCase)button.GetValue(ExclusiveCaseProperty); }
public static bool GetCloseContainingDropDown(Button element) { return (bool) element.GetValue(CloseContainingDropDownProperty); }