Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

I cretaed a tappgesture events and doesn't work

$
0
0

My images are changed in runtime. This is my xaml page

<StackLayout Padding="0" Spacing="0" Margin="0" x:Name="outerStack">
    <Grid x:Name="grd" RowSpacing="1" ColumnSpacing="1" Padding="0" Margin="0" >
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <Label x:Name="lblPrestacaoContas" Text="" Grid.Row="1" Grid.Column="0" TextColor="White" FontAttributes="Bold"/>
    <Label x:Name="lblPendencias" Text="" Grid.Row="1" Grid.Column="1" TextColor="White" FontAttributes="Bold"/>
    <Label x:Name="lblOcupacao1" Text="" Grid.Row="2" Grid.Column="0" TextColor="White" FontAttributes="Bold"/>
    <Label x:Name="lblOcupacao2" Text="" Grid.Row="2" Grid.Column="1" TextColor="White" FontAttributes="Bold"/>
    <Label x:Name="lblCheckList" Text="" Grid.Row="3" Grid.Column="0" TextColor="White" FontAttributes="Bold"/>

    <Image x:Name="imgFaturamento" Grid.Row="0" Grid.Column="0" Source="{local:ImageResource Operacional.Images.faturamento-03.png}" Aspect="AspectFill" >
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="imgTckCancelados" Grid.Row="0" Grid.Column="1" Source="{local:ImageResource Operacinal.Images.tickets cancelados-05.png}" Aspect="AspectFill">
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnTckCanceladosTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="imgPrestacaoContas" Grid.Row="1" Grid.Column="0" Source="{local:ImageResource Operacional.Images.prestação de contas-07.png}" Aspect="AspectFill">
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnPrestacaoContasTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="imgArrecadacao" Grid.Row="1" Grid.Column="1" Source="{local:ImageResource Operacional.Images.pendencias de arrecadação-10.png}" Aspect="AspectFill">
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnPendenciasTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="imgOcupacao1" Grid.Row="2" Grid.Column="0" Source="{local:ImageResource Operacional.Images.ocupação maior 80-15.png}" Aspect="AspectFill" >
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnOcupacaoTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="imgOcupacao2" Grid.Row="2" Grid.Column="1" Source="{local:ImageResource Operacional.Images.ocupação menor 60-16.png}" Aspect="AspectFill">
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnOcupacaoTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="imgCheckList" Grid.Row="3" Grid.Column="0" Source="{local:ImageResource Operacional.Images.checklist-24.png}" Aspect="AspectFill">
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnCheckListTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <Image x:Name="MyImage" Grid.Row="3" Grid.Column="1" Source="{local:ImageResource Operacional.Images.mensagens-21.png}" Aspect="AspectFill">
        <Image.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnTrocaImageTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
        </Image.GestureRecognizers>
    </Image>

    <AbsoluteLayout>
        <Label x:Name="lblFaturamento" Text="" AbsoluteLayout.LayoutBounds="20,5,40,100" Grid.Row="0" Grid.Column="0" TextColor="White" FontAttributes="Bold"/>
        <Label x:Name="lblCancelados" Text=""  AbsoluteLayout.LayoutBounds="20,5,40,100" Grid.Row="0" Grid.Column="1" TextColor="White" FontAttributes="Bold"/>
    </AbsoluteLayout>
    </Grid>

    <Grid x:Name="grdBottom" RowSpacing="0" ColumnSpacing="0" Margin="0" Padding="0">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <StackLayout Grid.Row="0" Grid.Column="0" Spacing="0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand"  >
            <Image x:Name="imgCheckListCinza" Source="{local:ImageResource Operacional.Images.paineis icone-57-btn.png}" Aspect="AspectFill" >

            </Image>
        </StackLayout>

        <StackLayout Grid.Row="0" Grid.Column="1"  Spacing="0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" >
            <Image x:Name="imgPainesCinza" Source="{local:ImageResource Operacional.Images.check list icone-56.png }" Aspect="AspectFill" >

            </Image>
        </StackLayout>

        <StackLayout Grid.Row="0" Grid.Column="2" Spacing="0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" >
            <Image x:Name="imgMobileCinza" Source="{local:ImageResource Operacional.Images.mobile conect-55.png}" Aspect="AspectFill" >

            </Image>
        </StackLayout>

        <StackLayout Grid.Row="0" Grid.Column="3" Spacing="0" Padding="0" VerticalOptions="StartAndExpand" HorizontalOptions="StartAndExpand" >
            <Image x:Name="imgPrestacaoContasCinza" Source="{local:ImageResource Operacional.Images.prestação de contas icone-54-btn.png}" Aspect="AspectFill" >

            </Image>
        </StackLayout>
    </Grid>
</StackLayout>

but i swap the image this way

if (CorIndicador == "VERDE")
    image.Source = ImageSource.FromResource("Operacional.Images.faturamento-03.png");
else
{
     var pinta = CorIndicador == "VERMELHO" ? image.Source = ImageSource.FromResource("Operacional.Images.faturamento caixa-26.png") : image.Source = ImageSource.FromResource("Operacional.Images.faturamento-02.png");
}

the issue is when i tap the image nothing happens. Before, when i had other image inside a boxview worked. I changed boxview to an image that ocuupy all cell(row/column) and now not work. PS: i have no error. I putted a break point and doesn't break at point.

I forgot code behind. This is my TappedGesture

     async void OnTapGestureReconizerTapped(object sender, EventArgs e)
            {
                PainelB2B p = new PainelB2B
                {
                    IdPainel = (int)TipoIndicador.Faturamento,
                    Nome = "Faturamento"
                };

                await Navigation.PushModalAsync(new VisualizadorPainel(p));
            }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>