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
4
votes
1 answer

Handler for Custom Attached Event

I'm using a custom Attached Event that I created and I'm trying to add a handler to this event public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void dataGridTasks_Drop(object…
Zied
  • 1,696
  • 12
  • 20
4
votes
3 answers

RoutedEvent "the member is not recognized or is not accessible"

Rather than use an event generated by an input device, I want to use a custom event that will be raised programatically in the code-behind as an EventTrigger in my xaml. This should be laughably easy but I can't find an example anywhere. Here's what…
Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
4
votes
1 answer

Is it possible to create a custom routed event in windows phone 8 app?

I have a user control and I'm currrently trying to implement a custom routed event in it according to this tutorial: http://msdn.microsoft.com/en-us/library/ms752288.aspx I get an error saying that "The name 'EventManager' does not exist in the…
src091
  • 2,807
  • 7
  • 44
  • 74
4
votes
3 answers

Programmatically Call WPF TargetedTriggerAction

I have a TargetedTriggerAction from a 3rd party library that would like to call/invoke without attaching it to a button. I have no problem getting it to work with the button, but I want to do it in response to some non-UI event. Here is the action's…
Keith G
  • 4,580
  • 5
  • 38
  • 48
3
votes
1 answer

Handling the Window's RoutedEvent in many WPF elements with Style

I have the following routed event: public static readonly RoutedEvent FakeEvent = EventManager.RegisterRoutedEvent( "Fake", RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(MainWindow)); public event RoutedEventHandler Fake { add {…
Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233
3
votes
2 answers

Why is FrameworkElement.SizeChanged not raised in this code

According to the documentation "(FrameworkElement.SizeChanged) Occurs when either the ActualHeight or the ActualWidth properties change value on this element." Running the following test method, my Rectangle's ActualWidth and ActualHeight are…
Grokodile
  • 3,881
  • 5
  • 33
  • 59
3
votes
1 answer

Bind an event from a UserControl into the parent Window- Routed events - C# XAML

I have multiple instances of the same User Control inside a stack panel, with a button in each user control. When I click this button I want it to open a new window and then disable the stack panel containing all the user controls, such that…
Jamestrod
  • 219
  • 2
  • 11
3
votes
3 answers

Can/Should MouseEnter event bubble?

Is it possible under any circumstances to get MouseEnter event bubbling? MSDN says it's an attached event with Direct routing strategy, which technically excludes such possibility. I've a fairly complex control (in essence a hierarchy consisting of…
user572559
3
votes
1 answer

Can anyone raise any RoutedEvent in WPF?

In C# events were always very protected: Only the owner of the event could trigger them. However, this seems to be completely different in WPF - Anyone can throw any event at any time. To test that, I've written the code in the bottom. When I used…
VitalyB
  • 12,397
  • 9
  • 72
  • 94
3
votes
1 answer

The event 'foo' is not a RoutedEvent

I tried making a Routed Event in a user control of an existing project and I'm getting the error message The event 'foo' is not a RoutedEvent. To make sure I wasn't crazy, I made an example project with just the offending code (a Minimal, Complete,…
Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
3
votes
2 answers

How do I swallow the dropdown behavior inside an Expander.Header?

I would like to prevent an Expander from expanding/collapsing when users click inside the header area. This is basically the same question as Q 1396153, but I'd appreciate a more favorable answer :) Is there a non-invasive way to do this? I am not…
Peter Seale
  • 4,835
  • 4
  • 37
  • 45
3
votes
1 answer

EventTrigger RoutedEvent not triggered with Custom Event

I am trying to trigger a storyboard to play when a custom routed event (defined by me) is fired. The event is called CustomTest and is defined in MyControl. Although the event is being fired, the trigger is not playing the…
Goose
  • 1,307
  • 2
  • 14
  • 28
3
votes
2 answers

Routed event syntax

I have a question about Routed Events, I see in some documentation that when we define our own custom events, we add and remove handlers to it using the following code: public event RoutedEventHandler CustomClick { add {…
user2755525
  • 219
  • 2
  • 3
  • 14
3
votes
1 answer

How to Handle Routed Event From a Child Window

Intention is to get and handle Routed Events from child Window. I cannot (read: do not want to) use direct routing as there are more elements between (a Command). The following example demonstrates that Event Routing is not working from one Window…
J Pollack
  • 2,788
  • 3
  • 29
  • 43
3
votes
2 answers

Add RoutedEvent via TemplateBinding

I want to use a RoutedEvent on a Border in a XAML Dictionary. The RoutedEvent comes from the class for which the template is, how can I achieve this? ModernWindow.cs /// /// Gets fired when the logo is clicked. /// public static…
Knerd
  • 1,892
  • 3
  • 28
  • 55
1 2
3
15 16