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 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 code segment should you use?

You use Microsoft .NET Framework 4 to create a Windows Forms application.
You have a dataset as shown in the following exhibit.
You plan to add a DataGridView to display the dataset.
You need to ensure that the DataGridView meets the following requirements:
* Shows Order Details for the selected order.
* Shows only Order Details for items that have UnitPrice greater than 20.
* Sorts Products by ProductName
Which code segment should you use?

Which code fragment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You write the following code segment.
public class Contact { private string _contactName;
public string ContactName {
get { return _contactName; }
set {
if (string.IsNullOrEmpty(value))
throw new ApplicationException(“Contact name is required”);
_contactName = value;
}
}
}
You add the following code fragment in a WPF window control.
<TextBox Text=”{Binding Path=ContactName, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged}” />
The TextBox control is data-bound to an instance of the Contact class. You plan to implement an ErrorTemplate in the TextBox control.
You need to ensure that the validation error message is displayed next to the TextBox control. Which code fragment should you use?

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 two actions should you perform?

You use Microsoft .NET Framework 4 to create a Windows Forms application.
You add a new class named Customer to the application.
You select the Customer class to create a new object data source.
You add the following components to a Windows Form:
* A BindingSource component named customerBindingSource that is data-bound to the Customer object data source.
* A set of TextBox controls to display and edit the Customer object properties.
* Each TextBox control is data-bound to a property of the customerBindingSource component.
* An ErrorProvider component named errorProvider that validates the input values for each TextBox control.
You need to ensure that the input data for each TextBox control is automatically validated by using the ErrorProvider component.
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 add to the code-behind file?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You write the following code fragment.
<StackPanel>
<StackPanel.Resources>
<Style TargetType=”{x:Type Button}”>
<EventSetter Event=”Click” Handler=”ButtonHandler”/>
</Style>
</StackPanel.Resources>
<Button Name=”OkButton”>Ok</Button>
<Button Name=”CancelButton” Click=”CancelClicked”>Cancel</Button>
</StackPanel>
You need to ensure that the ButtonHandler method is not executed when the user clicks the CancelButton button.
Which code segment should you add to the code-behind file?


Page 12 of 13« First...910111213