2017-03-03 5 views
1

Ist es möglich, ein Stacklayout in einer Schaltfläche zu setzen?Stack-Layout in einer Schaltfläche Xamarin Forms

 <StackLayout HorizontalOptions="Start" Orientation="Horizontal"> 
      <Label Text="s" FontFamily="icon-font" FontSize="16" FontAttributes="Bold" TextColor="{StaticResource orangeColor}"></Label> 
      <Label Text="Test" FontSize="16" FontAttributes="Bold" /> 
     </StackLayout> 

Ich habe ein Symbol Font-Datei. Ich möchte das Symbol und den normalen Text innerhalb des Schaltflächeninhalts rendern. Ist es möglich, in Xamarin Forms zu tun?

+2

Nein, aber Sie können wie eine Schaltfläche, um Ihre StackLayout Aussehen und wirken lassen. – Jason

Antwort

1

Sie können eine TapGestureRecognizer auf Ihre Etiketten speichern, um sie wie ein Knopf „Klick“ können

var tapGestureRecognizer = new TapGestureRecognizer(); 
tapGestureRecognizer.Tapped += (s, e) => { 
    // handle the tap 
}; 
myLabel.GestureRecognizers.Add(tapGestureRecognizer); 
Verwandte Themen