WPF网格列未正确对齐图像

时间:2012-11-01 12:34:44

标签: wpf grid alignment

下面网格视图的最后一列没有垂直显示在中心,虽然第一张图像是并且他们使用相同的查找方法来查找图像源(我拥有的资源字典对象定位器类)。最终图像(CurrencyImg)使图像的底部与行的中间对齐,因此它向上延伸到视图之外并且不填充行的下半部分。困惑!

<Grid Name="grdCustomer" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="300" />
                            <ColumnDefinition Width="220" />
                            <ColumnDefinition Width="50" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="30" />
                            <ColumnDefinition Width="30" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="18"/>
                        </Grid.RowDefinitions>

                        <Image Source="{y:ImageStaticResource {Binding IconString}}" Margin="0,0,0,0" VerticalAlignment="Center" ></Image>
                        <TextBlock Grid.Column="1" Text="{Binding CustomerDesc}" VerticalAlignment="Center" />
                        <TextBlock Name="tbTxnCount" Grid.Column="2" Text="{Binding TxnCount}" VerticalAlignment="Center" />
                        <TextBlock Name="tbAmount" Style="{StaticResource myCustStyleColor}" Grid.Column="3" Text="{Binding Amount}" HorizontalAlignment="Right" VerticalAlignment="Center"  />
                        <TextBlock Name="tbCurrency" Grid.Column="4" Text="{Binding Currency}" HorizontalAlignment="Right" VerticalAlignment="Center"  />
                        <Image Name="imgCurrency"  Grid.Column="5" Margin="0,0,0,0"  Source="{y:ImageStaticResource {Binding CurrencyImg}}" VerticalAlignment="Center" />
                    </Grid>

0 个答案:

没有答案