Ensurepass

QUESTION 151

You are developing a Windows Presentation Foundation (WPF) application.

You need to ensure that the application includes a container control that supports logical scrolling by default. Which control should you select?

 

A.            StackPanel

B.            WrapPanel

C.            Grid

D.            Canvas

 

Correct Answer: A

 

 

QUESTION 152

You are developing a Windows Presentation Foundation (WPF) application with multiple windows.

The majority of the buttons within the application are styled consistently. However, three buttons within the application must be styled differently. You need to ensure that the application can handle this styling requirement. What should you do?

 

A.    Create the styles in the application resources. Specify the TargetType property to be Button for the default style but not for the three buttons.

B.    Create the styles in the main window resources. Specify the TargetTypeproperty to be Button for the default style but not for the three buttons.

C.    Create the styles in the main window resources. Omit the Key property for the default Button style and specify the Key property for the Button style and the three buttons.

D.    Create the styles in the application resources. Omit the Key property for the default Button style and specify the Key property for the Button style and the three buttons.

 

Correct Answer: D

 

 

QUESTION 153

You are developing a Windows Presentation Foundation (WPF) application.

The application’s main window lists a series of controls horizontally until a control reaches the edge of the window. At that point, the series of controls continues on a new line. You need to ensure that this layout persists when the user changes the size of the window. What should you do?

 

A.    Place each control in a WrapPanelcontrol and set its Orientationproperty to Horizontal.

B.    Place each control in a StackPanelcontrol and set its Orientationproperty to Horizontal.

C.    Place the controls in a Grid and define the rows and columns using star sizing.

D.    Place each control in a DockPanelcontrol and set its Dock property to Left.

 

Correct Answer: A

 

 

QUESTION 154

You are developing a Windows Presentation Foundation (WPF) application.

The application is bound to a data source. You need to ensure that the style of controls is bound to values retrieved from the data source. What should you do?

A.    Create a Trigger element within the style that specifies the property value as the bound property.

B.    Create the style and specify the TargetTypeattribute.

C.    Create a DataTriggerelement within the style that specifies the path to the bound property.

D.    Create the style and specify the BasedOnattribute.

 

Correct Answer: C

 

 

QUESTION 155

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.

You plan to allow users to customize background colors, foreground colors, and font style of the application. You also plan to add a TextBlockcontrol to the application. You write the following code fragment (line numbers are included for reference only).

clip_image002

You need to ensure that the ContextMenucontrol is associated with the TextBlockcontrol. You also need to ensure the properties that can be customized are shown hierarchically. Which code fragment should you insert at line 15?

 

A.    clip_image004

B.    clip_image006

C.    clip_image008

D.    clip_image010

 

Correct Answer: D

 

 

QUESTION 156

You are developing a WPF application. You have the following style defined in the app.xaml file

clip_image012

You need to apply this style to a button named button1 in the application at runtime.

 

A.    button1.Style = this.FindResource(“btnItalic”) as Style;

B.    button1.Style = this.FindName(“btnItalic”) as Style;

C.    button1.Style = this.FindResource(“styleItalic”) as Style;

D.    button1.Style = this.FindName(“styleItalic”) as Style;

 

Correct Answer: A

 

 

 

 

QUESTION 157

You are employed as an application developer at ABC.com. You make use of Microsoft .NET Framework 4 to develop Windows Presentation Foundation (WPF) applications.

You have recenty created an application, and cofigured it to have a composite user control. You also configured the user control to have a TextBox control, named txtEntry. You then configure the user control to be stored in a window, and include the following code in the constructor of the user control:

AddHandler(TextBox.TextChangedEvent, new RoutedEventHandler(Audit_TextChanged), true);

Which of the following statements are TRUE? (Choose all that apply.)

 

A.    A text-changed event handler, named Audit_TextChanged, was created for the txtEntry control.

B.    Audit_TextChanged will stop running because the event is marked as handled by certain event handlers

C.    Even though the event is marked as handled by certain event handlers, Audit_TextChanged will still run.

D.    Audit_TextChanged will continue to run until the event is marked as handled.

 

Correct Answer: AC

 

 

QUESTION 158

You are employed as an application developer at ABC.com. You make use of Microsoft .NET Framework 4 to develop Windows Presentation Foundation (WPF) applications.

After developing an application, named ABCApp22, you configure a Button control and a MenuItem control that will be hosted by a window. The Button control and the MenuItem control have both been named Add.

You have configured the exact same RoutedCommand, named AddCommand, as the Command properties of these two controls. You then write the code shown below:

Private void CanAdd (object sender, CanExecuteRoutedEventArgs e) { … }

You are then informed that the two controls should be disabled when the CanExecute property is set to to false.

Which combination of the following actions should you take? (Choose all that apply.)

 

A.     You should consider having an event handler configured for the CanExecuteChanged event of the AddCommand command.

B.     You should consider having a CommandBinding object added to the CommandBindings property of the window.

C.     You should consider having a CommandBinding object added to the CommandBinding section of the MenuItem control.

D.     You should consider having the CanAdd method called from within the event handler.

E.     You should consider having the AddCommand inherited from the RoutedUICommand class.

F.      You should consider having the Command property of CommandBinding set to the AddCommand command.

G.     You should consider having the CanAdd method called from within the constructor of the AddCommand command.

H.     You should consider having the CanExecute property of the CommandBinding object set to the CanAdd method.

 

Correct Answer: BFH

 

 

QUESTION 159

You are employed as an application developer at ABC.com. You make use of Microsoft .NET

Framework 4 to develop Windows Presentation Foundation (WPF) applications.

You have created a new application, and written the code shown below:

MediaPlayer player = new MediaPlayer();

player.Open(new URI(AudioFilePath), UriKind.Relative)); player.play();

You then inserted this code into the button onclick event.

Which of the following statements are TRUE with regards to the configuration?

 

A.     The media player will open as soon as a user clicks the button, but no file will be played.

B.     The file that is stored in the AudioFilePath variable will be played as soon as the button is clicked by the user.

C.     All files stored in the media player will be played in sequence.

D.     All files stored in the media player will be played randomly.

 

Correct Answer: C

 

QUESTION 160

You are employed as an application developer at ABC.com. You make use of Microsoft .NET Framework 4 to develop Windows Forms applications. After developing a new application, named ABCApp13, you include a custom class named ABCClient.

You have configured a new object data source, and also added a BindingSource component named ABCclientBindingSource to a Windows Form. The ABCclientBindingSource component is configured to be data-bound to the ABCClient data source.

You then configure the Windows form to have two TextBox controls for presenting and modifying ABCClient. You have bound the data of these controls to its own ABCclientBindingSource property. The Windows form is also configured to contain an ErrorProvider component, named errorProvider. The data entries for the TextBox controls will be validated by the ErrorProvider component.

You want to configure the validation process to occur automatically.

Which of the following actions should you take?

 

A.     You should consider throwing an exception when the value is invalid to apply the validation

rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid. You should also consider inserting the code shown below in the InitializeComponent method of the Windows Form.

this.errorProvider.DataSource = this.ABCclientBindingSource;

B.     You should consider throwing an exception when the value is invalid to apply the validation rules inside the TextChanged event handler of each TextBox control by throwing an exception when the value is invalid. You should also consider inserting the code shown below in the InitializeComponent method of the Windows Form.

this.errorProvider.DataSource = this.ABCclientBindingSource.DataSource;

this.errorProvider.DataMember = this.ABCclientBindingSource.DataMember;

C.     You should consider throwing an exception when the value is invalid to apply the validation rules inside the setter of each property of the ABCClient class. You should also consider inserting the code shown below in the InitializeComponent method of the Windows Form.

this.errorProvider.DataSource = this.ABCclientBindingSource.DataSource; this.errorProvider.DataMember = this.ABCclientBindingSource.DataMember;

D.     You should consider throwing an exception when the value is invalid to apply the validation rules inside the setter of each property of the ABCClient class. You should also consider inserting the code shown below in the InitializeComponent method of the Windows Form. this.errorProvider.DataSource = this.ABCclientBindingSource;

 

Correct Answer: D

 

Download Latest MCTS 70-511 Real Free Tests , help you to pass exam 100%.

Comments are closed.