Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You create a window that has an arbitrary size. You plan to add two Button controls to the window. You need to ensure that each Button control fills exactly half the window space.
Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You create a window that has an arbitrary size. You plan to add two Button controls to the window. You need to ensure that each Button control fills exactly half the window space.
Which XAML code fragment should you use?

A.
<Grid>
<Button Grid.Column="0">Some content</Button>
<Button Grid.Column="1">Another</Button>
</Grid>

B.
<Grid>
<Button Grid.Column="0" Width="Auto">Some content</Button>
<Button Grid.Column="1" Width="Auto">Another</Button>
</Grid>

C.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0">Some content</Button>
<Button Grid.Column="1">Another</Button>
</Grid>

D.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0">Some content</Button>
<Button Grid.Column="1">Another</Button>
</Grid>



Leave a Reply 0

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