FAQ Database Discussion Community


Can I communicate from child viewmodels to main window with a routed command or routed event?

wpf,mvvm,routed-events,routed-commands
I'm building an MVVM WPF application with a custom dialog box control that resides in and is managed by the main window. I'd like to be able to launch this dialog from anywhere in the application (e.g. from a viewmodel belonging to some child view somewhere). My question is: can...

How are UI events generated in WPF?

c#,wpf,events,routed-events,uievent
I am trying to understand how UI related RoutedEvents are generated in WPF. For instance, how does pressing the left mouse button on a control starts the tunneling of PreviewMouseDown? I couldn't find a clear answer myself. My intuition is that the messages received by the window (e.g. WM_MOUSEFIRST) are...

WPF routedevent storyboard begin only if height is zero

wpf,storyboard,wpf-controls,routed-events
I have the following XAML for a border trigger that uses a routed event <Border.Triggers> <EventTrigger RoutedEvent="MouseLeftButtonUp" EnterActions=""> <BeginStoryboard> <Storyboard> <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0:0:0.4" Storyboard.Target="{Binding ElementName=messageWriterDefinition}" Storyboard.TargetProperty="Height"> <DiscreteObjectKeyFrame > <DiscreteObjectKeyFrame.Value> <GridLength>20</GridLength> </DiscreteObjectKeyFrame.Value>...