Reputation: 2129
I am having trouble aligning my items in my Gridview
. I have a DataTemplate
that has a Stackpanel
within it. Inside of that Stackpanel
I have 3 TextBlocks
. I am unable to move those textblock where I want to in the Gridview
. I will post my XAML below..
XAML
<Page.Resources>
<DataTemplate x:Key="TileTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding TitleView}" FontFamily="Segoe UI" FontWeight="SemiBold" FontSize="18" Foreground="White" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10" />
<TextBlock Text="{Binding BodyView}" FontFamily="Segoe UI" FontWeight="Light" FontSize="14" Foreground="White" TextWrapping="Wrap" Margin="10,50" />
<TextBlock Text="{Binding AuthorView}" FontFamily="Segoe UI" FontWeight="Light" FontStyle="Italic" FontSize="10" Foreground="White" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,10" />
</StackPanel>
</DataTemplate>
</Page.Resources>
<Grid x:Name="tileGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<GridView x:Name="tileGridView" Margin="12,60" ItemTemplate="{StaticResource TileTemplate}">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Style.Setters>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid Background="#2A2A2A"
Margin="5"
Height="200"
Width="300">
<ContentPresenter />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
</GridView.ItemContainerStyle>
</GridView>
</Grid>
This is the result I am getting:
As you can see it is completely cutting out the Author and is not aligning my body correctly (via my inline styling of the textblock).
Does anyone know of a way I can manipulate the position of the textblocks in my GridView?
Upvotes: 1
Views: 252
Reputation: 490
Set the Orientation of the StackPanel to be Vertical with a Left Horizontal Alignment and see if that gives you the desired look.
Upvotes: 1