views:

316

answers:

1

As the title says...

<Grid>
 <HyperlinkButton x:Name="Link" Background="Green">
  <Grid Background="Red">
   <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition />
   </Grid.ColumnDefinitions>
   <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="12" />
   </Grid.RowDefinitions>
   <Image x:Name="AvatarImage" Style="{StaticResource AvatarStyle}" Grid.Column="0" Grid.Row="0" />
   <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
    <TextBlock Text="New Topic" Style="{StaticResource ItemTypeStyle}" />
    <TextBlock x:Name="Title" Style="{StaticResource HeadlineStyle}" TextWrapping="Wrap" />
    <TextBlock x:Name="SubText" Style="{StaticResource TextStyle}" TextWrapping="Wrap" />
   </StackPanel>
   <TextBlock x:Name="TimeStampText" Grid.ColumnSpan="2" Grid.Row="1" Style="{StaticResource TimeStampStyle}" />
  </Grid>
 </HyperlinkButton>
</Grid>

The red background grid won't fill in the entire green HyperlinkButton. I've tried to set its alignment to "Stretch" but it has no effect. Pull it out of the link, and not surprisingly, it fills no problem. Suggestions?

A: 

Ugh... this was simple, sort of. HyperlinkButton has a HorizontalContentAlignment property, and that had to be set to stretch.

This extra property to achieve the consistent layout behavior normally found on HorizontalAlignement on the child objects is strange. Weird stuff like this is so not cool.

Jeff Putz

related questions