Questions tagged [routedevents]

14 questions
20
votes
3 answers

How to fire Unload event of Usercontrol in a WPF window

I have an UserControl in WPF:
davymartu
  • 1,393
  • 3
  • 15
  • 34
8
votes
4 answers

Button.MouseDown

I'm relatively new with WPF. I'm trying to understand the difference between MouseDownEvent and PreviewMouseDownEvent. I understand the WPF event strategies and i understand that the MouseDown event is a bubbling event and the PreviewMouseDown is a…
Gilad
  • 548
  • 1
  • 7
  • 22
8
votes
3 answers

Custom RoutedEvent as EventTrigger

I have my own shape class public sealed class MirrorTile : Shape and in this class I added the event public static readonly RoutedEvent SelectedEnterEvent = EventManager.RegisterRoutedEvent("SelectedEnter", RoutingStrategy.Bubble,…
Christian
  • 344
  • 1
  • 2
  • 12
5
votes
2 answers

Wpf stop routing event when MessageBox appear?

I've PreviewMouseDown event on TreeView in order to determine if user can select other item based on some logic. If the current item data changed, will appear MessageBox that asks the user if he want to discard the changes. if user press YES , I…
yossharel
  • 1,819
  • 2
  • 23
  • 29
4
votes
3 answers

Scrollviewer blocking events

the thing i am battling today is the scrollviewer, and the fact that it blocks my events.SO..here's some xaml:
ALex Popa
  • 339
  • 7
  • 16
2
votes
1 answer

WPF Command bindings - how can I get to event handlers

Hi Is there any way to choose from where XAML should use command bindings event handlers? I added copule of command binding to my cusotm control, however functions which are resonsible for execute and can_execute are not directly in code behind but…
wpflerner
  • 21
  • 2
2
votes
1 answer

Making WPF user control mark click events as handled

I have a custom controls which propagates the mouse click event up the visual tree and I would like to get rid of this behaviour. Is there a way to mark a routed event (which was raised by button click or other mouse event) as handled from xaml in…
Vitalij
  • 4,587
  • 9
  • 42
  • 65
1
vote
1 answer

Routed Events problem - hitting the root UI element before the child element

My routed events are hitting the root UI element before the child element. Is this expected? How can I have the routed events hit the child element first? Objective: If text is typed anywhere other than "custom textbox", put text in "default…
patrick
  • 16,091
  • 29
  • 100
  • 164
1
vote
1 answer

WPF: Handling bubbling events only from one specific content

Now I'm about to learn RoutedEvents. I understand bubbling and tunneling and all. But I have a little problem I'm not sure how to handle. I've got a ItemsControl in my own defined UserControl ( inherits TabItem ). This itemsControl could be a…
Ingó Vals
  • 4,788
  • 14
  • 65
  • 113
1
vote
1 answer

WPF Routed events firing?

I have a WPF form with 3 buttons and have routed events on them, commands are binded on start... private void InitCommandBinding(UIElement frameworkElement) { CommandBinding commandBinding; commandBinding = new…
abmv
  • 7,042
  • 17
  • 62
  • 100
1
vote
0 answers

How to define a new Routed Event using EventManager class and how to raise this event?

I came across EventManager class in WPF and found that it can define a new routed event. But I could not understand it correctly through my sources. Can someone please explain how EvenManager class define a new Routed event & how to raise this…
WpfBee
  • 2,837
  • 6
  • 23
  • 29
0
votes
1 answer

WPF - Handling a RoutedEvent in the parent for a specific control instance

In my user control I have several textboxes e.g. Textbox1, Textbox2. In the parent I only want to handle KeyDown events raised from Textbox1, not all Textbox I have added a handler in the parent this.AddHandler(TextBox.KeyDownEvent, new…
empo
  • 1,133
  • 5
  • 21
  • 41
0
votes
2 answers

Top element prevet firing of MouseUp for the back element

I'm designing a UserControl in WPF. There is a canvas with some paths. Among those path I have two Ellipses (top and bottom of the picture). I'm doing some works when MouseUp event of the Ellipses is fired but when the user clicks on the plus/minus…
Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
0
votes
2 answers

Silverlight 3 LoadedEvent routed to ViewModel

My client is trying to hook to a usercontrols Loaded Event in the View Model. Basically they want to know when the controls loaded event triggers inside the view model. They are looking for a way to do it without code behind the xaml. Is this…
cjibo
  • 4,487
  • 6
  • 27
  • 34