AndreiMisiukevich/TouchEffect

Button pressed state with label

Closed this issue · 3 comments

Hi, i have a question. ;)
Is it possible with your component to set a button in pressed state if the user touches a label. Lets say i have this xaml:

  <StackLayout>
    <StackLayout.GestureRecognizers>
      <TapGestureRecognizer Tapped="BtnChangeTheme_Clicked" />
    </StackLayout.GestureRecognizers>
    <Button     CornerRadius="25"
                HeightRequest="50"
                WidthRequest="50"
                FontSize="20"
                VerticalOptions="Center"
                HorizontalOptions="Center"
                Text="Glyph"
                x:Name="BtnChangeTheme"
                Clicked="BtnChangeTheme_Clicked"/>
    <Label Text="LabelTest"
           HorizontalTextAlignment="Center">      
    </Label>
  </StackLayout>

This example generates a round button with a FA glyph. Under the button i need a text for description. Now i want the button to change the state if the user presses the label. I hope you understand what i want to achieve.

Hi, I don't think that's possible (we can change Opacity/Scale or any other properties of that button and it perhaps will look very similar but simulate "press" is not possible)

You can use Trigger for updating those properties (Observe TouchEff.State)

here is how in xaml
#45 (comment)

for some reasons DataTriggers don't work with attached properties in xamarin (Perhaps I did something wrong)