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
1
vote
1 answer

Route event From Item to a Collection in MVVM

How can I do something like this? public class person { public ICommand Add_as_Friend { get; private set; } public event EventHandler C1_Friend_Add; //.... Add_as_Friend = new Command(Handle_Add_FR, HandleCan_Add_FR); void…
1
vote
3 answers

Handling a bubbling event raised from a modal dialog in main window

I have a modal dialog in my WPF application that allows a user to login to a server. The dialog simply contains a User Control that handles all the login stuff (UI, web service call, and raising a routed event when the call returns). All works…
Vincent Mimoun-Prat
  • 28,208
  • 16
  • 81
  • 124
1
vote
1 answer

WPF RoutedEvents Being Handled By...?

I have a 3D application in WPF which basically is supposed to zoom in and out as the MouseWheel event is fired. I have attempted to subscribe everything possible, but can't find what it is which is handling it. Is there a way to find out what is? Or…
Alex
  • 187
  • 1
  • 2
  • 7
1
vote
1 answer

WPF how to stop scrollviewer from moving up and down during zooming

I have a Grid inside ScrollViewer. I set a long height for the grid. Dynamically, I add a Canvas to my Grid and add 2 rectangles inside it. The mouse zoom event is working but when I launch the app and scroll down to the end of the 2 boxes and I try…
user1019042
  • 2,428
  • 9
  • 43
  • 85
1
vote
1 answer

Routed events and dependency properties .NET wrapper confusion

I'm new to WPF and have a confusion about wrapping syntax of routed events and dependency properties I've seen on many sources that routed events and dependency properties are wrapped like this // Routed Event public event RoutedEventHandler…
ammar26
  • 1,584
  • 4
  • 21
  • 41
1
vote
0 answers

Can my RoutedEvents arguments validly have settable parameters (like RoutedEventArgs.Handled)?

My WPF Custom Control handles dragging shapes across an image on a canvas. Some shapes may be dragged beyond the limits of the image but others should be limited. But the control itself does not know the rules, only clients (i.e. the XAML page…
Joe
  • 5,394
  • 3
  • 23
  • 54
1
vote
1 answer

Is this the way RoutedEventArgs.Handled works?

On my way to understanding WPF RoutedEvent handling, is this the way it works? Say I have a Window with a Grid and a Button inside the Grid. My Button_Click event handler looks like this: private void Button_Click(object sender, RoutedEventArgs…
Sami
  • 2,050
  • 1
  • 13
  • 25
1
vote
1 answer
1
vote
1 answer

Copy a RoutedEvent handler from one control to another

I have a WPF MenuItem, returned from a function with no other information, and I want to set another (new) MenuItem's click event to be the same function as the first MenuItem. I have seen code to do this in Windows forms (e.g. Is it possible to…
Darren
  • 4,408
  • 4
  • 39
  • 57
1
vote
1 answer

Routed Events & ScrollViewer

Here's how my element tree is composed (irrelevant informations removed).
Gab
  • 5,604
  • 6
  • 36
  • 52
1
vote
0 answers

MVC .NET Urls aren't routed using the RouteCollection

We're using MVC .NET and the RouteCollection class to route URLs in our web app. This functions normally until we pass a URL containing the the text "PRN" anywhere inside the URL. When this happens, the routing will not occur and a 400 Page Not…
Bryce
  • 11
  • 1
1
vote
1 answer

C# - Get a list of subscribers listening to a RoutedEvent?

I'm trying to get a list of objects that are subscribing to the PasswordBox PasswordChanged event. The PasswordBox has a static readonly RoutedEvent PasswordChangedEvent and an instance PasswordChanged event. Thanks!
michael
  • 14,844
  • 28
  • 89
  • 177
1
vote
0 answers

Routed Event can only be applied to types that are derived from the defining class

I'm getting the following error using a custom routed event: The local property "CustomClick" can only be applied to types that are derived from the "ExampleClass". Here is my ExampleClass: public class ExampleClass { public static readonly…
Vermot
  • 11
  • 2
1
vote
1 answer

Get TreeViewItem datacontext from root container

I have a Window with two use controls. One encapsulates a TreeView control and another is marely a string representation of a selected TreeViewItems details. TreeView controls is already self sufficient - it will populate itself with content items.…
Maxim V. Pavlov
  • 10,303
  • 17
  • 74
  • 174
1
vote
1 answer

Not able to handle PreviewMouseDown

Hey; I have the following visual hyerarchy in a usercontrol: Grid -> Canvas -> MyContentControl MyContentControl is a class derived from ContentControl that has an adorner on top that is a rectangle, this is to make it easier to click on certain…
SoManyGoblins
  • 5,605
  • 8
  • 45
  • 65