I have an event trigger that I want to be fired in response to two different routed events. I don't want to repeat the event response code (in XAML) twice. Can I specify multiple routed events for a single event trigger declaration?
Example of a single event:
<Style.Triggers>
<EventTrigger RoutedEvent="Button.MouseEnter">
...
I have a complex application that consists of an Application, containing many modules, each containing many views. The behaviours of my views may throw exceptions.
Sometimes I want to handle exceptions on the view that created them, sometimes in the parent module, sometimes in the grand-parent application.
The concept of RoutedEvents s...
Hi,
A very well known fact is that routed events only travel up or down the ancestry and not through all the elements.
But an equally known fact is that an event handler can be wired in the common parent of two disparate controls.
My questions is how, some pointers please.
I have XAML that looks like
<Grid Name="MainGrid">
<Lis...
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 is there a way to have the event not handled, or for an encompassing UIElement to get to...
In WPF we have routed events. When should these be used instead of regular events?
...
Hi,
I was learning about routed events in wpf and I tries the following example,
File -- Window1.xaml
<ScrollViewer VerticalScrollBarVisibility="Auto">
<UniformGrid MouseDown="UniformGrid_MouseDown">
<Button x:Name="Button1">1</Button>
<Button x:Name="Button2">2</Button>
<Button x:Name="Button3">3</But...
I was wondering if there's a way to watch all RoutedEvents that are raised in a WPF application. A way to write some info about the events fired to the console would be prefect to see what's going on.
...
I have a WPF window, which has a button that is inside a stackPanel, which is inside another stackPanel
I wrote an event handler for the button for the MouseDown event.
I want to execute this eventHandler three times for the button and the parent (stack panel) and the parent's parent
How can I achieve that with the routed event, by wri...
I've got a collection of ViewModels that are rendered as tabs using a style to pull out the relevant content to display on the tab:
public class TabViewModel : DependencyObject
{
public object Content
{
get { return (object)GetValue(ContentProperty); }
set
{
SetValue(ContentPropert...
I've got an application that traps text entry at the window level (i'm using a barcode scanner) and occasionally the operator will click on view elements which then gain focus, taking focus off the window, and the window no longer recieves either previewtextentry or textentry events, any ideas?
...
Hi everyone,
There are a lot of discussions about M-V-VM and Command binding (RelayCommand) but not a lot has been covered on Routed Events binding to a handler in a M-V-VM pattern. I want to find what is the best approach.
Here is an example of RoutedEvent binding using a custom event and a bound event handler to the VM.
<Navigation:...
Hi,
I have an Asp.Net web page, having the common Asp.Net form. The outer "border" of the page (i.e. main menu, header, ...) is build using normal Asp.Net code using a master page. The content of that page uses jQuery to display dynamic forms and to send data to the server.
If I push the return key on that page, I jump to a (more or le...
When i create a user control that has a CommandBinding to a RoutedUICommand im worried that i get memory leaks.
scenario:
Have a RoutedUICommand as a static in c class where i store my commands
Implement the CommandBindings on a user control.
Add the user control to the main form.
Remove the user control from the main form, set the re...
I have a normal WPF window, let's call it TopLevel which has a bunch of controls in it, among other things a simple ListView which should log certain events in different elements in the application.
So suppose I have a Grid in TopLevel which contains a bunch of user controls called Task. Each Task has an object associated with them as a...
I have a custom control that overrides Window:
public class Window : System.Windows.Window
{
static Window()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new System.Windows.FrameworkPropertyMetadata(typeof(Window)));
}
...
}
It also has a style:
<Style TargetType="{x:Type ...
I've got a custom Button class, that always performs the same action when it gets clicked (opening a specific window). I'm adding a Click event that can be assigned in the button's XAML, like a regular button.
When it gets clicked, I want to execute the Click event handler if one has been assigned, otherwise I want to execute the defaul...
I'm struggling with the TagVisualizer control on an MS Surface project. In theory the control seems great, allowing you to respond to input from real world physical objects
The problem is that the control will cover the entire screen (since I want to capture tags on the entire screen) and as such, no other controls in my app will receiv...
While trying to do something a bit more complicated, I ran across a behavior I don't quite understand.
Assume the following code below handling the textChanged event.
private void textChanged(object sender, TextChangedEventArgs e)
{
TextBox current = sender as TextBox;
current.Text = current.Text + "+";
}
No...
Hello,
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 sure exactly how to attach behavior to the Expander.Header content to prevent mous...
Hi,
I'd like to add tabs to my window when an item in the GridView is double-clicked. But the tab that will be added depends on the clicked item. Which way should I do this on WPF? I thought about RoutedEvents, but I don't know how to pass a parameter with it. Any suggestions?
...