transfer message between different user controls in WPF/C# -


I have created a video player window using WPF / C #, which includes parts, monitors, sliders and some players There are buttons, such as the following image shows:

Enter image details here Since all users Control objects are written in a single .xaml, the file will be large and difficult to edit. So I divided the control object into several separate .xaml files, for example, I defined a public partial class player_control: UserControl which contains all player buttons but now I do not know that this How to send messages from user controls to other controls, e.g. Slider player_slider . Normally, if we click the button next frame, the function player_slider.ValueChange will trigger, but I do not know how to implement such functions.

I am please help me with a question.

What message does I define in the player control, one for each button:

  Public Static Readonly Routing Event Playist = EventManager.RegisterEvent ("Play", ...); Public Event RoutedEventHandler Play {add {AddHandler (PlayEvent, value); } Remove {RemoveHandler (PlayEvent, value); }} Public Static Readonly Routing Event Stop Event = Event Manager Registrar Event ("Stop", ...); Public Event RoutedEventHandler Stop {add {AddHandler (StopEvent, Value); } Remove {RemoveHandler (StopEvent, value); }}. . .  

Then any other control needs to be done when a user clicks on a single button, then he needs to subscribe to the event:

  & lt; Local: Playersbuttonplay = "PlayerBootins_play" stop = "PlayerBootsApps" / & gt;  

After that, you can press PlayerButtons_Play & amp; PlayerButtons_Stop methods


Comments