70-511 · Question #58
You are developing a Windows Presentation Foundation (WPF) application to play audio files. You add a MediaElement control named mediaElementl and a Button control named btnPlayAudio to the design…
The correct answer is D. CommandBinding playCommand =. See the full explanation below for the reasoning.
Question
You are developing a Windows Presentation Foundation (WPF) application to play audio files. You add a MediaElement control named mediaElementl and a Button control named btnPlayAudio to the design surface. The MediaElement control Source attribute is set to an audio file. The LoadedBehavior attribute is set to Manual. You add the following code to the main window. void playCommand_Executed(object sender, RoutedEventArgs e) { mediaElementl.Play(); } You set the command of the button to MediaCommands.Play. You need to ensure that the application will play the audio file when the button is pressed. What should you add to the constructor of the main window?
Options
- ARoutedCommand playCommand = new RoutedCommand();
- BRoutedUICommand playCommand = new RoutedUICommand();
- CCommandBinding playCommand =
- DCommandBinding playCommand =
How the community answered
(35 responses)- A3% (1)
- B6% (2)
- C17% (6)
- D74% (26)
Community Discussion
No community discussion yet for this question.