routedevent

Can you use routed events with a MultiTrigger?

Does WPF support using a triggers that respond to routed events but only given a condition is met? For example, WPF supports triggering on routed events through Event Triggers. ie: <Button> <Button.Triggers> <EventTrigger RoutedEvent="Click"> ... </.. </.. </.. However I am looking for the trigger to go off only giv...

Are routed events weak in WPF

Does routed events in WPF store strong reference to the handler that is attached to them? ...

Fading out a wpf window on close

Hi, I want to fade a window in/out in my application. Fading in occurs on Window.Loaded and I wanted to fade out on close (Window.Closed or Window.Closing). Fading in works perfectly but a RoutedEvent is not allowed on Window.Closing. What RoutedEvent should I be using for Close? <Window.Triggers> <EventTrigger RoutedEvent="Win...

Removing Routed Event Handlers through Reflection?

Hi! Background: I'm using WPF and C# (3.5) and am working on an app that allows a user to view a form/window/usercontrol that's already part of a compiled assembly. When they view it, they should be able to click on any control (buttons, textboxes, even labels), a little popup editor should appear by the control where they can then ty...

WPF handling RoutedEvent from UserControl

Hi, I have a UserControl, default one generated by VS, only TextBlock is added: <UserControl x:Class="MyNameSpace.Presentation.MyControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="myControl"> <Grid> <TextBlock x:Name="SomeTextBox" Text="So...

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 in XAML on the child node (not sure?) <PARENT> <MyControl DoSomethingOnUserActio...

Custom Routed Event Fails!

Hello 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 = EventManager.RegisterRoutedEvent( "PreviewArtistLinkClicked", RoutingStrategy...

Programmatically open context menu using UI automation?

I'm trying to implement a right click context menu using UI automation. Since UI automation does not have a native right click pattern I am adding an ExpandCollapse provider to the listview's AutomationPeer class and mapping the expand and collapse to opening and closing the context menu. My question, is there a better method of invoki...

Add a delay to OnContactDown events for Surface controls

We're using the Controls.PreviewContactDown, PreviewContactUp, and PreviewContactChanged events to capture tagged items being placed, removed, and moved on the Surface, which works great in the Simulator application that comes with the surface. On an actual Surface if you moved a tagged item too quickly the cameras actually lose focus ...

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

I have a class that needs to notify that something significant has occured. 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 a RoutedEvent to get this functionality but as this class neither has AddHandler nor Remo...

WPF FrameworkElement not receiving Mouse input

Trying to get OnMouse events appearing in a child FrameworkElement. The parent element is a Panel (and the Background property is not Null). class MyFrameworkElement : FrameworkElement { protected override void OnMouseDown(MouseButtonEventArgs e) { // Trying to get here! base.OnMouseDown(e); } } public clas...

Handled RoutedEvent continues to bubble up tree

Hello: I'm developing a TreeView based control and my double click event continues to bubble up my TreeViewItem nodes. The goal is to have the TreeViewItem expand or collapse when it is double clicked. I have a style that applies an event handler for the MouseDoubleClick event to each TreeViewItem. Here's the code that handles the e...

Passing Input events from HwndHost to underlying WPF controls?

hi there, is there a way to pass input events (primarily mouse, but eventually keyboard input too) that occurs on a HwndHost back to the underlying WPF controls (e.g. a panel) ? i can hook up to WndProc within the HwndHost and recveive the windows messages. can i manually create a routedevent for a mouse click and send it to the parent...

WPF - understanding RoutedEvents

Hi I'm learnign WPF and currently I'm reading about RoutedEvents. In book "Pro WPF in c#" there is some snipet of code which I present below <Window x:Class="RoutedEventsLearning.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" ...

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

Hello, 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 RTB_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Space) {...

Mouse event not reaching UIElement.

Hello smart people. I'm just getting into C# and some unfamiliar piece of code so apologies if my question is not well asked. The problem in short - I have a six by eight grid of System.Windows.Controls.Canvas objects. The top left canvas does not receive mouse events while all the others do (I tried OnMouseMove and OnMouseClick events...