Questions tagged [routedevent]

A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event.

53 questions
31
votes
2 answers

WPF Attached Events vs Non-Attached Events

The question is that after all my research I still can't find the difference between a regular routed event and a attached event. What is the functional the difference? or do others agree that there is none? Implementation The ButtonBase class…
Tim Valentine
  • 1,037
  • 1
  • 11
  • 10
22
votes
5 answers

Fading out a wpf window on close

I want to fade a window in/out in my application. Fading in occurs on Window.Loaded and I wanted to fade out on close (Window.Closed or Window.Closing). Fading in works perfectly, but Window.Closing is not allowed value for RoutedEvent…
James
  • 3,597
  • 11
  • 47
  • 57
15
votes
2 answers

How to convert a WPF Button.Click Event into Observable using Rx and F#

I am trying to replicate some C# code which creates an IObservable from a Button.Click event. I want to port this code to F#. Here is the original C# code which compiles without errors: Observable.FromEvent( …
Thorsten Lorenz
  • 11,781
  • 8
  • 52
  • 62
12
votes
2 answers

WPF FrameworkElement not receiving Mouse input

Trying to get OnMouse events appearing in a child FrameworkElement. The parent element is a Panel (and the Background property is not Null). class MyFrameworkElement : FrameworkElement { protected override void OnMouseDown(MouseButtonEventArgs…
lava
  • 121
  • 3
8
votes
1 answer

Passing Input events from HwndHost to underlying WPF controls?

is there a way to pass input events (primarily mouse, but eventually keyboard input too) that occurs on a HwndHost back to the underlying WPF controls (e.g. a panel) ? i can hook up to WndProc within the HwndHost and recveive the windows messages.…
Joachim Kerschbaumer
  • 9,695
  • 7
  • 49
  • 84
6
votes
1 answer

Are routed events weak in WPF

Does routed events in WPF store strong reference to the handler that is attached to them?
ligaz
  • 2,081
  • 13
  • 15
5
votes
3 answers

Removing Routed Event Handlers through Reflection?

Background: I'm using WPF and C# (3.5) and am working on an app that allows a user to view a form/window/usercontrol that's already part of a compiled assembly. When they view it, they should be able to click on any control (buttons, textboxes,…
Eddie
  • 359
  • 4
  • 11
5
votes
1 answer

WPF RoutedEvent (via EventManager.RegisterClassHandler)

I'm trying to find a generic way to track "Modified" of any control (databind or not) in the current window (this is e.g. to enable or disable the Apply button in a typical Options window.) In fact, I just need to hook up a few event handlers like…
newman
  • 6,841
  • 21
  • 79
  • 126
5
votes
2 answers

Handled RoutedEvent continues to bubble up tree

I'm developing a TreeView based control and my double click event continues to bubble up my TreeViewItem nodes. The goal is to have the TreeViewItem expand or collapse when it is double clicked. I have a style that applies an event handler for the…
Matthew
  • 2,759
  • 18
  • 28
5
votes
2 answers

Programmatically open context menu using UI automation?

I'm trying to implement a right click context menu using UI automation. Since UI automation does not have a native right click pattern I am adding an ExpandCollapse provider to the listview's AutomationPeer class and mapping the expand and collapse…
NCampbell
  • 51
  • 1
  • 3
5
votes
1 answer

Weird KeyUp behaviour (main form handles events from child?!)

The problem: KeyUp is handled by the grid in main window (Grid_KeyUp) Main window shows a child window (e.g. MessageBox.Show(...)) User presses [Return] (Keys.Return) to close the MessageBox Main window actually GETS the KeyUp event from that…
Jefim
  • 3,017
  • 4
  • 32
  • 50
4
votes
5 answers

WPF: How to prevent CheckBox.Checked event from being fired for ComboBox as a ToggleButton?

I have a lots of controls in a Window including checkboxes and comboboxes. I want to track CheckBox.IsChecked event, so I defined an event handler in Windows level as The problem…
newman
  • 6,841
  • 21
  • 79
  • 126
3
votes
1 answer

How to unit test CanExecuteRoutedEventHandler?

I am trying to write a unit test for the following code: public static void AppExitCmdCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = true; } The problem with this code is that I…
Manish Basantani
  • 16,931
  • 22
  • 71
  • 103
3
votes
1 answer

How to catch SourceUpdated for nested children of window?

I would like to know when any input element on my Window has its Binding source updated. The input elements could be TextBox, RadioButton, Slider, ComboBox etc, and may be nested within UserControls or Panels. Catching SourceUpdated would be nice,…
Greg Sansom
  • 20,442
  • 6
  • 58
  • 76
3
votes
2 answers

Mouse event not reaching UIElement

I have a 6x8 grid of System.Windows.Controls.Canvas objects. The top left canvas does not receive mouse events while all the others do. I tried OnMouseMove and OnMouseClick events. A child object isn't handling the event because…
tilish
  • 1,093
  • 1
  • 9
  • 20
1
2 3 4