none
怎样控制按钮的边界到准确的Grid边界? RRS feed

答案

  • 你好,

    使用Margin, VerticalAlignment属性就可以。

     <Grid x:Name="LayoutRoot" Background="Gray">
                  <Button x:Name="btn" Background="Red" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,0,0,0" Content="button" Foreground="Brown" Height="80" Width="200" />
        </Grid>
    Button的样式里内嵌的Grid默认是透明的(Background="Transparent"),可能你看到的没有对齐,是由于这个而导致的视觉效果,将Grid的Background属性改成其他颜色就可以看出来了。如图所示:


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2014年3月12日 9:21
    版主