Which code fragment should you use?

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?

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?

A.
<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>

B.
<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>

C.
<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>

D.
<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>



Leave a Reply 1

Your email address will not be published. Required fields are marked *


roy molenaar

roy molenaar

I’m not sure about this one. Answer C and D results in compilation errors. Shouldn’t it be answer A?

cheers roy