Questions tagged [routed-events]

a way for a windows presentation foundation (WPF) class to provide notifications to clients when some interesting thing happens to the object.

239 questions
5
votes
1 answer

Is there a XAML equivalent to AddHandler where you want to catch already-handled events?

According to UIElement.AddHandler on MSDN, you can pass in a boolean for the handledEventsToo argument so you can still be notified of handled events. Is there a XAML equivalent to this? Another way to do this is through the EventSetter class which…
Mark A. Donohoe
  • 28,442
  • 25
  • 137
  • 286
5
votes
1 answer

Why is there no MouseMoveEvent -- or, how to use AddHandler for the mouse move event

The UIElement class defines static RoutedEvent members MouseLeftButtonDownEvent and MouseLeftButtonUpEvent -- but there is no MouseMoveEvent. As far as I can tell, neither does any class in the framework hierarchy. There is the regular event…
McGarnagle
  • 101,349
  • 31
  • 229
  • 260
5
votes
1 answer

RoutedEvent Tunnel does not reach child

I found a lot of example explaining bubbling but none about Tunneling this is about Tunneling eg parent to child. I think my main problem is that i don't understand how to register the routed event in the child (WindowControl to UserControl). I…
Martin
  • 584
  • 3
  • 12
5
votes
3 answers

Bubbling RoutedEvent or RoutedCommand to a ViewModel

I've got a collection of ViewModels that are rendered as tabs using a style to pull out the relevant content to display on the tab: public class TabViewModel : DependencyObject { public object Content { get { return…
Anderson Imes
  • 25,500
  • 4
  • 67
  • 82
5
votes
2 answers

WPF Routed Event, subscribing to custom events

I am trying to get routed events working with child controls that will manually fire these events and they will bubble up and be handled at the main grid level. I basically want to do something like this:
landoncz
  • 1,997
  • 14
  • 15
5
votes
1 answer

Routed event class handler for LoadedEvent does not work for most classes

I'm trying to register handler for all Loaded events: EventManager.RegisterClassHandler(typeof(UIElement), FrameworkElement.LoadedEvent, new RoutedEventHandler(OnRoutedEvent), true); EventManager.RegisterClassHandler(typeof(ContentElement),…
Marcin Wisnicki
  • 4,511
  • 4
  • 35
  • 57
5
votes
2 answers

Custom attached events in WPF

I might be getting the terminology wrong here, but I think I'm trying to create an attached event. In the Surface SDK, you can do things like:
Josh Santangelo
  • 936
  • 4
  • 11
  • 16
4
votes
2 answers

WPF routed events handling in UserControl

I have a WPF UserControl that contains a button. I also have a WPF Window that contains a button. In both the UserControl and the Window I place the following line in XAML: UIElement.PreviewMouseLeftButtonDown="OnPreviewMouseLeftButtonDown" and in…
Itai Bar-Haim
  • 1,686
  • 16
  • 40
4
votes
1 answer

In WPF, is it possible to specify multiple routed events for a single event trigger?

I have an event trigger that I want to be fired in response to two different routed events. I don't want to repeat the event response code (in XAML) twice. Can I specify multiple routed events for a single event trigger declaration? Example of a…
Jordan Parmer
  • 36,042
  • 30
  • 97
  • 119
4
votes
1 answer

PreviewMouseDown not tunnelling as expected

I have the following tree on my app: MainWindow (Window) > LayoutRoot (Grid) > (MyCustomControl) > Item1 (Grid) > Button (Button1) MyCustomControl derives from ItemsControl and displays its items on a StackPanel. MyCustomControl needs…
Zmaster
  • 1,095
  • 9
  • 23
4
votes
1 answer

MouseEnter and MouseLeave processing in WPF (using VS2008 and .net 3.5) not working as expected

It is not easy to explain the problem without an image and without code. For those interested, I have made a sample C#/WPF project that can be downloaded from http://rapidshare.com/files/461745095/02.WPFControlEvents.rar It is a very small project…
Hex440bx
  • 657
  • 6
  • 16
4
votes
1 answer

How to use Interaction.EventTrigger and bubbling custom events in WPF

I am trying to handle a RoutedEvent from a UserControl I built by hooking it up to a command using Interaction.Triggers. The following works--it calls the AddingNewThingCommand:
Ben Zuill-Smith
  • 3,504
  • 3
  • 25
  • 44
4
votes
1 answer

Direct Routed Event question

A colleague and I were chatting about routed events, and we came up with some things that didn't make a lot of sense. Primarily, what is the purpose of a Direct event, and why are both LeftMouseButtonDown and PreviewLeftMouseButtonDown direct…
Nicros
  • 5,031
  • 12
  • 57
  • 101
4
votes
1 answer

Click event for controls below other controls

I have two controls A and B. Control B is placed over A. When B is clicked only it's clicked event is fired, however I need the click event of A to fire too. Can this somehow be realized using routed events? Here's a screenshot of the controls: alt…
stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
4
votes
1 answer

Checking if a RoutedEvent has any handlers

I've got a custom Button class, that always performs the same action when it gets clicked (opening a specific window). I'm adding a Click event that can be assigned in the button's XAML, like a regular button. When it gets clicked, I want to execute…
Andrew Koster
  • 1,550
  • 1
  • 21
  • 31
1
2
3
15 16