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
1
vote
2 answers

WPF Application Command Bindings doesn't work

Hi I have a strange problem with CommandBindings in WPF. I add CommandBindings in constructor of object. The command bindings looks like that CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy,Copy_Executed,Copy_Enabled)); …
losieko
  • 271
  • 3
  • 5
1
vote
1 answer

WPF handle double click event on Thumb and raise it as new event on another control

I tried with a behavior with no luck Behavior: public sealed class BubbleDoubleClickEvent : Behavior { #region TargetElement public UIElement TargetElement { get { return (UIElement)GetValue(…
Mauro Sampietro
  • 2,739
  • 1
  • 24
  • 50
1
vote
1 answer

Silverlight; Change Grid's background on mouseover

Simply i want to change the Grid's background color (in Silverlight) when the mouse enters and reset it when the mouse leaves. So I tried different ways but no success. Here is what I have tried: 1: using EventTriggers:
Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
1
vote
1 answer

C#/WPF - RoutedEvent in WPF class that isn't a UIElement

I have a class that needs to notify that something significant has occurred. The class is in a WPF-project, even though this specific class, is lookless (and doesn't inherit from UIElement, neither directly or indirectly). Normally, I just register…
Andreas
  • 53
  • 5
1
vote
1 answer

Why does the Handled property in PreviewMouseLeftButtonDownEvent affect a ClickEvent?

Consider you add a ClickEvent- and PreviewMouseLeftButtonDown-Handler for a Button When clicking the Button, first…
Em1
  • 1,077
  • 18
  • 38
1
vote
1 answer

How to run trigger in View from ViewModel appropriately?

I would like to take an action in my View after raising an event in ViewModel. I found a solution here but it seems quite complicated. Isn't there any built-in mechanism? I've read also about raising RoutedEvent in ViewModel but this approach…
eklxw
  • 189
  • 1
  • 14
1
vote
6 answers

WPF View-ViewModel Loosely coupled communication

Using WPF my team is attempting to seperate the design and the code using the MVVM design patterns. To accomplish this, we are slowly moving away from the UserControl approach as this has a high ammount of coupling between design and code. We have…
1
vote
1 answer

Custom Routed Event Fails!

My application looks like this: 1 Window 2 Frame 3 Page 4 Control In Control (4) I have a custom routed event, which i want Frame (2) to handle. The event: public static readonly RoutedEvent PreviewArtistLinkClickedEvent =…
ErikTJ
  • 2,001
  • 3
  • 21
  • 38
1
vote
2 answers

WPF How to create CUSTOM tunel routedevent?

I need a simple example of a Tunnel Routed Event tunnelling from a parent control to a child control. (THIS IS NOT REAL CODE) -- in fact, the deeper I go, the more I think that the XAML is wrong -- probably should NOT sign up for the tunnelled event…
Sumtraveller
  • 1,186
  • 2
  • 9
  • 13
1
vote
2 answers

WPF button EventTrigger=Button.IsEnabledChanged

I want to animate a color change of a button (based on its IsEnabled property) in two ways: 1) when it is changed from enabled to disables -> the color will be changed from white to black. 2) when it is changed from disabled to enabled -> the color…
Dazy Jackson
  • 85
  • 1
  • 4
  • 12
0
votes
2 answers

Focusing element produced in a style trigger via ContentTemplate

Working with WPF I'm trying to produce a TextBlock which, upon double click, "transforms" into a TextBox ready for editing. After that, an Enter key, Esc key or losing focus causes the editing to end, and the TextBox to revert to a TextBlock. The…
RedGlow
  • 773
  • 7
  • 13
0
votes
1 answer

How do I use a routed event from a child element that is created on the fly?

I have an event in my MainWindow that is being fired from one of my child controls as a routed event. The MainWindow has an AddHandler call to catch the routed fire. I would like to fire this same event from ANOTHER child element, but this element…
joepetrakovich
  • 1,344
  • 3
  • 24
  • 42
0
votes
1 answer

Why are my tunneling event arguments object and bubbling event arguments object not equal?

I'm working through the 70-511 book, and am looking at the section on Routed Events. I noticed it mentions that bubbling-tunneling event pairs share the same EventArgs instance, so if you handle the tunneling event (eg PreviewMouseDown), it halts…
AndyM_LVB
  • 41
  • 4
0
votes
1 answer

Button inside a MenuItem won't open Sub-MenuItems

I have a Button inside a MenuItem.Header like this:
Shachar Har-Shuv
  • 666
  • 6
  • 24
0
votes
2 answers

I want the moment when a Key is "Down" in the PreviewKeyDown Event in WPF

when I jump into the PreviewKeyDown the char righthand to the Caret in my RichTextBox is not moved YET. I would like to say to this event do your stuff move the char to the rightside and THEN let me do MY stuff. How can I do that? private void…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321