将按钮宽度设置为与其高度相同(Xamarin Forms)

时间:2016-07-12 09:39:04

标签: xaml xamarin

我正在尝试制作一个圆形按钮,我无法将其高度设置为与其宽度相同。这是我试过的代码:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MozaikMuzeum_Xamarin.View.CatalogPage" Title="Katalógus" BackgroundColor="White">
  <ContentPage.Content>  
    <Grid>
     <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="100" />
      </Grid.RowDefinitions>

      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="100" />
      </Grid.ColumnDefinitions>
      <Button Text="Ajánló"
           Grid.Row="0" Grid.Column="0"
           TextColor="Black"
           x:Name="Button"
              BindingContext="{x:Reference Name=Button}"
       BorderWidth="4"
              BorderColor="Black"
              BackgroundColor="#FFF"
              BorderRadius="50"
              HeightRequest="{Binding Width}"
        >

      </Button>
    </Grid>
  </ContentPage.Content>
</ContentPage>

0 个答案:

没有答案