PrepAway - Latest Free Exam Questions & Answers

Author: admin

Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You write the following XAML code fragment.

<Rectangle Name="SplineTest">
<Rectangle.RenderTransform>
<TranslateTransform x:Name="SplineTestTrans" X="0" Y="0" />
</Rectangle.RenderTransform>
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>

</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>

You need to ensure that the Rectangle object shifts diagonally downwards when a user clicks it.
Which XAML code fragment should you use?

Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application processes hospital medical records. The application contains a class named Patient that has a property named Age. You enter information about the patient in a window named Medical Form. In the window, you enter the age of the patient in a textbox named txtAge. You need to ensure that the application meets the following requirements:
* It updates the Age property automatically when you enter the age of the patient in the txtAge textbox.
* It updates the txtAge textbox automatically when you change the Age property of the Patient class.
Which XAML code fragment should you use?

Which code segment should you use?

You are creating a Windows Presentation Foundation GUI application by using Microsoft .NET Framework 3.5.
The application will process legal consent. You use the following code fragment to create a check box and two text boxes.
<Grid Height="214" Width="282">
<TextBox Height="21" Margin="132,36,30,0" Name="txtAge1" VerticalAlignment="Top" Text=" " />
<TextBox Height="21" Margin="133,81,29,0" Name="txtAge2" VerticalAlignment="Top" Text= " " />
<Label Height="23" Margin="66,0,96,54" Name="label1" VerticalAlignment="Bottom">
<Label.Content>
<MultiBinding Converter="{StaticResource myConsentConverter}" ConverterParameter="18">
<Binding ElementName="txtAge1" Path="Text" />
<Binding ElementName="txtAge2" Path="Text" />
</MultiBinding>
</Label.Content>
</Label>
</Grid>
The text boxes are used to enter the age of the applicants. You need to ensure that if you specify a value of 18 or more in the text boxes, the check box is selected.
Which code segment should you use?

Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application to track customer orders.
You use Microsoft .NET Framework 3.5 to create the application. The application contains an Order class. The Order class has two public properties named OrderDate and OrderID. The application also contains an ObservableCollection collection of Order objects. This collection is named OrderItems. You write the following XAML code fragment.
<Window.Resources>
<CollectionViewSource Source="{Binding Source={x:Static Application.Current}, Path=OrderItems}" x:Key="orders" />
</Window.Resources>
You add two ListBox controls to select orders based on the OrderID or the OrderDate properties. One ListBox control displays order dates and the other ListBox control displays order numbers. You need to bind the two ListBox controls so that the item selected in one control is reflected in the other control.
Which XAML code fragment should you use?

Which two tasks should you perform?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The XAML page for the application will display employee information from an XML file. The following code fragment is an excerpt from the XML file.
<Employee>
<Manager FirstName="Adam" LastName="Barr" Photo="E1.jpg"/>
<Engineer FirstName="Mu" LastName="Han" Photo="E2.jpg"/>

</Employee>

The file is exposed as a resource named employees.
You add the following templates under the Window.Resources element.
<DataTemplate x:Key="Manager">
<Image Source="{Binding XPath=@Photo}" Height="50"/>
</DataTemplate>
<DataTemplate x:Key="Engineer">
<Image Source="{Binding XPath=@Photo}" Height="40"/>
</DataTemplate>

You need to ensure that the selection of templates is dependent on the XML element being rendered.
Which two tasks should you perform? (Each correct answer presents part of the solution.)

Which code segments should you insert at lines 03 and 05?

You are creating Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application has a TreeView class that builds the directory tree for a given directory. You write the following class that represents a directory.

class Folder
{
public readonly string Name
{
get { … ;}
}

public readonly List<Folder> Subfolders
{
get { … ;}
}
}

You write the following code segment.
(Line numbers are included for reference only.)
01 TreeView tree = new TreeView() ;
02 Folder folder = new Folder("C:");
03
04 FrameworkElementFactory labelFactory = new FrameworkElementFactory(typeof(TextBlock)) ;
05
06 template.VisualTree = labelFactory ;
07 tree.ItemTemplate = template;
08 tree.ItemsSource = folder.Subfolders;

You need to ensure that the TreeView class displays nodes that correspond to the child folders of the C: drive.
Which code segments should you insert at lines 03 and 05?

Which event should you implement?

You create a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You deploy the application on client computers by using the ClickOnce technology. You need to ensure that the application downloads an assembly to a client computer only if the assembly is required.
Which event should you implement?