QUESTION 141
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You want to localize the application to use the German locale settings. You need to allow the ResourceManager class to retrieve a neutral German locale version of the text to be displayed in the user interface (UI). Which file should you add to the project?
A. Resources.de.xml
B. Resources.de-DE.xml
C. Resources.de.resx
D. Resources.de-DE.resx
Answer: C
QUESTION 142
You use Microsoft .NET Framework 4 to create a Windows Forms application. You plan to use a Windows Presentation Foundation (WPF) control of the UserControl1 type hosted in an ElementHos1 control named elementHost1.
You write the following code segment. (Line numbers are included for reference only.)
01 Public Class UPFInUInforms
02 Public Sub WPFInWInforms()
03 InitializeComponent()
04
05 End Sub
06 Private Sub OnBackColorChange(ByVal sender As Object, ByVal propertyName As [String], ByVal value As Object)
07 Dim host As ElementHost = TryCast(sender, ElementHost)
08 Dim col As System.Drawing.Color = DirectCast(value, System.Drawing.Color)
09 Dim brush As New SolidColorBrush(System.Windows.Media.Color.FromRgb(col,R, col.G, col.B))
10 Dim ucl As UserControll = TryCast(host.Child, UserControll)
11 ucl.Background = brush
12 End Sub
13 End Class
You need to ensure that the application changes the background color of the hosted control when the background color of the form changes.
Which code segment should you insert at line 04?
A. elementHostl.PropertyMap.Remove("BackColor")
elementHost1.PropertyMap.Add("BackColor", New PropertyTranslator(OnBackColorChange))
B. elementHost1.PropertyMap.Remove("Background")
elementHost1.PropertyMap.Add("Background", New PropertyTranslator(OnBackColorChange))
C. elementHostl.PropertyMap.Add("BackColor", New PropertyTranslator(OnBackColorChange))
elementHost1.PropertyMap.Apply("BackColor")
D. elementHostl.PropertyMap.Add("Background", New PropertyTranslator(OnBackColorChange))
elementHost1.PropertyMap.Apply("Background")
Answer: A
QUESTION 143
You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives. A data trend analysis is performed in a function named UpdateTrendData. The trend analysis is a long-running process.
The application contains the following code segment.
Class MainWindow
Private Sub UpdateData(By Val arg As Object) Dim data As Double = UpdateTrendData() …
End Sub
End Class
UpdateData is currently invoked on the UI thread when the form is first displayed.
You need to process the data in a manner that does not cause the UI to freeze.
What should you do?
A. Use ThreadPool.SetMaxThreads(2,2) and invoke UpdateData.
B. Use ThreadPool.QueueUserWorkltem to invoke UpdateData.
C. Use Me.Dispatcher.BeginInvoke to invoke UpdateData passing in the priority of Normal.
D. Use Me.Dispatcher.BeginInvoke to invoke UpdateData passing in the priority of Background.
Answer: B
QUESTION 144
You are developing a Windows Presentation Foundation (WPF) application that contains a custom Button control.
The custom Button control can be set as active by setting an IsActive property to True. You need to ensure that the IsActive property can be bound to a business object.
What should you do on the custom Button control?
A. Implement IsActive as a Microsoft .NET property.
B. Implement IsActive as a Dependency property.
C. Implement INotifyPropertyChanged.
D. Implement IQueryable.
Answer: B
QUESTION 145
You are developing a Microsoft .NET 4 application.
You need to ensure that security error trapping handles transparency violations.
What should you do?
A. Handle all thrown transparency violations explicitly.
B. Handle only SecurityAction.Demand transparency violations.
C. Handle only SecurityAction.Assert transparency violations.
D. Handle only SecurityAction.PermitOnly transparency violations.
Answer: A
QUESTION 146
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You add a property named ServiceContext to a control. You need the value of ServiceContext to flow to the child controls exactly like the value of the DataContext property of the FrameworkElement class.
What should you do?
A. Inherit the control class from the Dependency-Object class.
B. Register a dependency property.
In the options settings of the property metadata, specify the Inherits option.
C. Declare a new property.
In the get and set methods of the new property, create an instance of the TraversalRequest class.
D. Declare a new property.
In the get method of the new property call VisualTreeHelper.GetParent.
In the set method of the new property, call VisualTreeHelper.GetChild.
Answer: C
QUESTION 147
You are developing a Windows Forms application that contains a DataGridView control. The DataGridView is composed of several fields that capture the customer’s name, address, and phone number.
You have been asked to provide data validation in a DataGridView to prevent users from leaving the name field if the name field is empty.
You need to ensure that users cannot tab out of the name field without entering data.
What should you do?
A. Validate the name field in the CellValidating event. Set e.Cancel = True if the name field is empty.
B. Validate the name field in the CellErrorTextChanged event. Get e.RowIndex if the name field is empty.
C. Validate the name field in the CellEnter event. Set the focus on the name field if the name field is empty.
D. Validate the name field in the CancelRowEdit event. Set the focus on the name field if the name field is empty.
Answer: A
QUESTION 148
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.
You need to implement the MyProject.MyConverter class.
What should you do?
A. Implement the IValueConverter interface.
B. Implement the IMultiValueConverter interface.
C. Inherit from the TypeConverter class.
D. Apply the TypeConverterAttribute attribute.
Answer: A
QUESTION 149
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You add a ListBox control to the application. The ListBox control is data-bound to an instance of a custom collection class of the Product objects named ProductList.
The number of items of the data-bound collection is fixed. However, users can modify the properties of each of the Product objects in the collection.
You need to ensure that changes made on the Product objects are automatically reflected in the ListBox control.
What should you do?
A. Implement the INotifyPropertyChanged interface in the Product class.
B. Implement the INotifyCollectionChanged interface in the ProductList class.
C. Set the Mode property of the Binding object of the ListBox control to TwoWay.
D. Set the UpdateSourceTrigger property of the Binding object of the ListBox control to PropertyChanged.
Answer: A
QUESTION 150
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains an ObservableCollection object named Pictures that contains several Picture objects. Each Picture object contains the Name and PictureFilePath properties.
You add a ListBox control to the application.
You need to ensure that the pictures are displayed in the ListBox control.
Which code fragment should you use?
A. <ListBox ItemsSource="{Binding Source={StaticResource pictures}}"> <ListBox.Item>Template>
<DataTernplate>
<TextBlock>
<TextBlock.Text>
<Binding Path="PictureFilePath" />
</TextBlock.TextX/TextBlock>
</DataTemplate>
</ListBox. ItemTeioplate>
</LiscBox>
B. <ListBox ItemsSource="{Binding Source={StaticResource pictures}}"> <ListBox. ItemTemplate>
<DataTemplace>
<Image Source="{Binding Source={StaticResource pictures}, Path=PictureFilePath)"/> </DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
C. <ListBox ItemsSource="{Binding Source={StaticResource pictures}>"> <ListBox.ItemTemplate>
<DataTemplate>
<TextBlockxTextBlock.Text>
<Binding Path="Name" />
</TextBlock.TextX/TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
D. <ListBox ItemsSource="{Binding Source={StaticResource pictures))"> <ListBox.ItemTemplate>
<DataTemplate>
<Image Source-"{Binding Path PictureFilePath>"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Answer: D
Unabridged Pass4sure Microsoft 70-511 PDF Dumps Free Download