PrepAway - Latest Free Exam Questions & Answers

Category: 70-511

Exam 70-511: TS: Windows Applications Development with Microsoft .NET Framework 4

Which code segment should you write in the constructor of the MainWindow class?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The
application has a window named MainWindow that has a StackPanel control named sp as the root element.
You want to create a Button control that contains a TextBlock control with the “Save” Text property.
You need to create the control dynamically and add the control to sp.
Which code segment should you write in the constructor of the MainWindow class?

Which code segment should you insert at line 03?

You use Microsoft .NET Framework 4 to create a Windows Forms application.
You write the following code segment. (Line numbers are included for reference only.)
01sealed class FormSettings :
ApplicationSettingsBase
02{
03
04public String Description
05{
06get { return (String)this[“Description”]; }
07set { this[“Description”] = value;}
08}
09}
You need to ensure that the first time each user opens the application, a text field displays the following message: “Please enter your setting.”
Which code segment should you insert at line 03?

What should you do?

You upgrade a Windows Forms application to Microsoft .NET Framework 4. The application was developed
by using a previous version of the .NET Framework. The application uses the Code
Access Security (CAS) policy for file access.
When the application is executed, you receive the following exception:
“NotSupportedException: This method uses CAS policy, which has been obsoleted by the .NET Framework.”
You need to resolve the error.
What should you do?

Which code segment should you insert at line 05?

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
ElementHost control named elementHost1.
You write the following code segment. (Line numbers are included for reference only.)
01public class WPFInWinForms {
02public WPFInWinForms
03{
04InitializeComponent();
05
06}
07private void OnBackColorChange(object sender, String propertyName, object value)
08{
09ElementHost host = sender as ElementHost;
10System.Drawing.Color col = (System.Drawing.Color)value;
11SolidColorBrush brush =
new SolidColorBrush(System.Windows.Medi
a.Color.FromRgb(col.R, col.G, col.B));
12UserControl1 uc1 = host.Child as UserControl1;
13uc1.Background = brush;
14}
15}
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 05?

Which two actions should you perform?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You write the following code segment. (Line numbers are included for reference only.)
01public class Contact
02{
03private string _contactName;
04
05public string ContactName {
06get { return _contactName; }
07set { _contactName = value; }
08}
09
10}
You add the following code fragment within a WPF window control.
<TextBox>
<TextBox.Text>
<Binding Path=”ContactName” UpdateSourceTrigger=”PropertyChanged”>
<Binding.ValidationRules>
<DataErrorValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
The TextBox control is data-bound to an instance of the Contact class.
You need to ensure that the Contact class contains a business rule to ensure that the ContactName property is not empty or NULL.
You also need to ensure that the TextBox control validates the input data.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two).

Which binding expression should you use?

You use Microsoft Visual Studio 2010 and Microsoft .
NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You create a WPF window in the application.
You add the following code segment to the application.
public class ViewModel
{
public CollectionView Data { get; set; }
}
public class BusinessObject
{
public string Name { get; set; }
}
The DataContext property of the window is set to an instance of the ViewModel class.
The Data property of the ViewModel instance is initialized with a collection of BusinessObject objects.
You add a TextBox control to the Window.
You need to bind the Text property of the TextBox control to the Name property of the current item of the CollectionView of the DataContext object.
You also need to ensure that when a binding error occurs, the Text property of the TextBox control is set to N/A .
Which binding expression should you use?

Which code segment should you write for the click event handler for btnDetails?

You create a Windows client application by using Windows Presentation Foundation (WPF).
The application contains the following code fragment.
<Window.Resources>
<DataTemplate x:Key=”detail”>
<!–…–>
</DataTemplate>
</Window.Resources>
<StackPanel>
<ListBox Name=”lbDetails”>
</ListBox>
<Button Name=”btnDetails”>Details</Button>
</StackPanel>
You need to assign lbDetails to use the detail data template when btnDetails is clicked.
Which code segment should you write for the click event handler for btnDetails?


Page 2 of 1312345...10...Last »