Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application that allows users to arrange images. You need to ensure that users can arrange child elements in a panel without affecting the size of the elements. You also need to ensure that child elements are oriented horizontally. Which control should you use?
- ListBox
- DockPanel
- WrapPanel
- StackPanel
Correct Answer: 4
Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You need to ensure that the application meets the following requirements:
- Displays a menu that is specific to the control selected by the user.
- Displays the menu next to the control.
Which control should you use?
- Menu
- PopUp
- ListBox
- ContextMenu
Correct Answer: 4
Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application that displays an image. You need to ensure that users can stretch and scale the image. Which control should you use?
- Frame
- Slider
- Viewbox
- ScrollViewer
Correct Answer: 3
Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. The application contains a window as shown in the following exhibit. You need to define a DockPanel control that fits the window. Which code fragment should you use?
<DockPanel>
<Button Content="Left"/>
<Button Content="Top" DockPanel.Dock="Top"/>
<Button Content="Bottom" DockPanel.Dock="Bottom"/>
<Button Content="Center"/>
</DockPanel><DockPanel>
<Button Content="Top" DockPanel.Dock="Top"/>
<Button Content="Bottom" DockPanel.Dock="Bottom"/>
<Button Content="Left"/>
<Button Content="Center"/>
</DockPanel><DockPanel> <Button Content="Left"/> <Button Content="Top" DockPanel.Dock="Top"/> <Button
Content="Center"/<Button Content="Bottom" DockPanel.Dock="Bottom"/> </DockPanel><DockPanel> <Button Content="Top" DockPanel.Dock="Top"/> <Button Content="Left"/> <Button
Content="Center"/> <Button Content="Bottom" DockPanel.Dock="Bottom"/> </DockPanel>
Correct Answer: 2
Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You plan to create a window that has a layout as shown in the following exhibit. You need to define the code fragment to create the window layout. You also need to ensure that the window contains a splitter line. Which code fragment should you use?
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="50*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Button>Item1</Button>
<Button>Item2</Button>
</StackPanel>
<GridSplitter HorizontalAlignment="Stretch" VerticalAlignment="Center" ShowsPreview="True" Height="2" />
<TextBlock Grid.Row="1">Please, select an item</TextBlock>
</Grid><Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="50*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Button>Item1</Button>
<Button>Item2</Button>
</StackPanel>
<GridSplitter HorizontalAlignment="Center" VerticalAlignment="Stretch" ShowsPreview="True" Height="2" /> <TextBlock Grid.Row="1">Please, select an item</TextBlock>
</Grid><Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="Auto*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Button>Item1</Button>
<Button>Item2</Button>
</StackPanel>
<GridSplitter.Grid Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" ShowsPreview="True" Height="2" />
<TextBlock Grid.Row="2">Please, select an item</TextBlock>
</Grid><Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50*" />
<RowDefinition Height="Auto*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Button>Item1</Button>
<Button>Item2</Button>
</StackPanel>
<GridSplitter.Grid Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" ShowsPreview="True" Height="2" />
<TextBlock Grid.Row="2">Please, select an item</TextBlock>
</Grid>
Correct Answer: 3