我使用标签作为按钮。如何用圆边包围它?

时间:2018-01-29 09:08:38

标签: xamarin xamarin.forms

以下是我与Xamarin Forms一起使用的代码:

<Grid Grid.Column="0" ColumnSpacing="0" Margin="0,0,10,0">
   <Label Grid.Column="0" x:Name="faveIconLabel" Style="{StaticResource mediumIcon}" Margin="0,2,0,0" HorizontalOptions="Fill" FontFamily="FontAwesome" VerticalOptions="Center" VerticalTextAlignment="Center" />
   <Label Grid.Column="1" x:Name="hiddenIconLabel" Style="{StaticResource mediumIcon}" Margin="0,2,0,0" HorizontalOptions="Fill" FontFamily="FontAwesome" VerticalOptions="Center" VerticalTextAlignment="Center" />
</Grid>

有人可以帮忙,让我知道如何用边框围绕这两个标签,使它们看起来像按钮一样。

1 个答案:

答案 0 :(得分:5)

框架可用于此目的:

      <Grid Grid.Column="0" ColumnSpacing="0" Margin="0,0,10,0">

        <Frame Grid.Column="0" CornerRadius="5" OutlineColor="Black">
          <Label  x:Name="faveIconLabel" Style="{StaticResource mediumIcon}" Margin="0,2,0,0" HorizontalOptions="Fill" FontFamily="FontAwesome" VerticalOptions="Center" VerticalTextAlignment="Center" />
        </Frame>

        <Frame Grid.Column="1" CornerRadius="5" OutlineColor="Black">
          <Label x:Name="hiddenIconLabel" Style="{StaticResource mediumIcon}" Margin="0,2,0,0" HorizontalOptions="Fill" FontFamily="FontAwesome" VerticalOptions="Center" VerticalTextAlignment="Center" />
        </Frame>

      </Grid>