routed

WPF Routed Commands and ShowDialog Windows

Hello, I was wondering how a window opened through ShowDialog is treated in the Visual Tree. For example, Window A opens Window B through a ShowDialog. When firing a routed command on Window B, Window A does not receieve the command (even though it is listening for it). Is there any way to make this work? Thanks! Jon ...

WPF ItemsControl: Route TextChanged Event to all UserControl Items

Hello, I've placed in a ItemsControl Container (Template Stackpanel) my UserControls, which get dynamically added and removed while running the application. How can I route an Event (e.g. TextChanged or GotFocus) trough all elements in my UserControl (consists mainly of TextBoxes)? Is this where I should use "Delegates" or ICommand? I'm...

How to add Command Binding to an Items control that does not have the command binding property

I use the MVVM pattern and I have the following code: <DataTemplate x:Key="ActivityEditTemplate"> <ItemsControl ItemsSource="{Binding Path=ActivityList}"> <ItemsControl.ItemTemplate> <DataTemplate> <CheckBox Margin="2,0,2,0" Content="{Binding ActivityDescrip...

C#/WPF: Catch Routed Event (UIElement.PreviewKeyUp) from UserControl

Hello, I've a UserControl which contains a TextBox called myTextBox. This UserControl is placed in a MainWindow.xaml where I'm trying to catch the "UIElement.PreviewKeyUp". Now when debugging, I can see the "UserControl" as sender, not the TextBox. How can I check if the KeyEventArgs e (especially e.Key) were sent from the TextBox call...

WPF: How to create custom preview routed event?

I mean the following: I have a custom control which has StateChangedEvent: public class WindowControl : ContentControl { public static readonly RoutedEvent StateChangedEvent; static WindowControl() { WindowControl.StateChangedEvent = EventManager.RegisterRoutedEvent("StateChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), ty...

How to create custom pair of event/preview event?

I mean if i have some custom event with bubbling strategy, then who must declare preview event and who must care about its raising? Me or WPF? for example I has class with event public class WindowControl : ContentControl { public static readonly RoutedEvent StateChangedEvent; static WindowControl() { WindowControl.StateChangedEvent ...

How To Get Global MouseMove And KeyDown Events In Silverlight

Application.Current.RootVisual.KeyDown += Application_KeyDown The above does not work if I'm on a ChildWindow - that was instantiated in runtime. My question is, how do I get the mousemove or keydown event in the Parent Window that hosts this ChildWindow? Also, I'd rather not change anything in the childwindow (i.e., add an event that...

WPF and events from dynamically created controls

Hi, I need some help to implement a common behavior in some controls. In my WPF application, I have a main form that contains a panel and a button: Ok The button will run a Save method when clicked.The Save method reads some data from the form and saves the data to...

WPF: Routed event for showing detail view of list box item?

So what I want to accomplish is that I have a listbox of items (for example: items in a basket) and when I mouse over one of them, I want to see a detailed view in another part of my window (with image and all that). BASICALLY what I did works - but there are three things that I don't like: a) I use "ItemsControl" so I have to bind the...

[WPF] Find out source of raised Routed Event

I've small trouble. I don't know why my controls firing events twice. I know it was discussed few times on stackOverflow, but still i cannot find out cause. Is there any way to debug application and find what is the main cause of raised event? I'm not good at (at this moment) profiling, but mayby it's the good path. Thx ...