C# 如何在网格中垂直放置两个堆栈面板?

C# 如何在网格中垂直放置两个堆栈面板?,c#,wpf,C#,Wpf,我将这样的网格放置在第一列的网格中 <Grid Grid.Column="0"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" Grid.Row="0"> <Imag

我将这样的网格放置在第一列的网格中

<Grid Grid.Column="0">
<Grid.RowDefinitions>
    <RowDefinition Height="*"/>
    <RowDefinition Height="*"/>
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal" Grid.Row="0">
    <Image Source="{Binding PictureUrl}" Width="100" Height="100" Stretch="Fill" HorizontalAlignment="Left"></Image>
</StackPanel>
<StackPanel Orientation="Horizontal"  HorizontalAlignment="Right" Grid.Row="1">
    <HyperlinkButton Content="{Binding Path=GeoLocation}"/>
    <TextBlock Text="{Binding Path=FormattedTimeStamp}"/>
</StackPanel>
</Grid>


图像很好。但是我看不到地理位置。我认为基于图像,它只需要100个宽度,所以它不会出现。但我想把图像放在左边。以及图像下方右侧的地理位置。谁能帮我找到解决办法。。此网格是数据模板的内容,仅供参考。

正如@coder所说,您可能只需将代码更改为:

<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
    <ColumnDefinitionsHeight="*"/>
    <ColumnDefinitionsHeight="*"/>
</Grid.ColumnDefinitions>

<StackPanel Grid.Column="0">
    ...
</StackPanel>
<StackPanel HorizontalAlignment="Right" Grid.Column="1">
    ...
</StackPanel>

...
...

您是否尝试删除方向部分?是的,地理位置和时间戳垂直放置在图像下方,但我需要将它们与完整数据一起水平放置。您已经给出了行定义,请尝试添加列宽,然后您可以执行此操作。