GestureRecognizers doesnt work on Image but on StackLayout - xamarin

Please someone tell me why this markup doesn't fire the tap gesture?
Not working
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
But this one does? And I did followed a very basic implementation from the Microsoft/Xamarin docs on how to add a GestureRecognizer.
If I switch to this markup it works perfect! Everything tested on Android phone 7.0 API 24. I use the latest Xamarin.Forms 3.3.0 pre 3 nuget package.
Working Markup
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" NumberOfTapsRequired="1" />
</StackLayout.GestureRecognizers>

Related

syncfusion xamarin form button control, click event not fired on IOS simulator but fired on my IPHONE

I am using syncfusion xamarin form button control on my project, the click event didn't fire on the IOS simulator but fired on both my IPHONE and IPAD. anyone experienced this issue?
the XMAL is attached below,
<buttons:SfButton Padding="10"
x:Name="btnCamera"
Grid.Column="1"
IsCheckable="False"
BackgroundColor="White"
BorderColor="Transparent"
BorderWidth="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Clicked="btnCamera_Clicked"
HasShadow="True"
CornerRadius="20">
<buttons:SfButton.Content>
<Image Source="Camera.png"
HeightRequest="45"
WidthRequest="45"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</buttons:SfButton.Content>
</buttons:SfButton>
<buttons:SfButton Padding="10"
x:Name="btnImageFolder"
Grid.Column="3"
IsCheckable="False"
BackgroundColor="White"
BorderColor="Transparent"
BorderWidth="0"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Clicked="btnImageFolder_Clicked"
HasShadow="True"
CornerRadius="20">
<buttons:SfButton.Content>
<Image Source="ImageFolder.png"
HeightRequest="45"
WidthRequest="45"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</buttons:SfButton.Content>
</buttons:SfButton>
Query: StackOverflow : syncfusion xamarin form button control, click event not fired on IOS simulator but fired on my IPHONE
We are unable to replicate the reported issue on our side. We are prepared a sample based on the provided code snippet since the ButtonClick event is properly called on our side. We have prepared a sample and video for your reference. Sample
Please make sure you have added SfButtonRenderer for iOS in the AppDelagates.cs file. Refer to the below link,
Link: https://help.syncfusion.com/xamarin/button/gettingstarted#additional-step-for-ios
Please check and let us know once the problem was resolved on your side.
Regards,
Ruba Shanmugam

Xamarin MAUI application not shows correct output

I have downloaded Visual Studio 2022 Professional (preview) version from
MS Document. Also I have followed the other steps to create first sample application using .Net MAUI template after VS installed.
It does create new project with all the required dependency. I have installed Android sdk api v30 and created a simulator as mentioned in the official document.
When I have run the application on Android Emulator it does take a lot time to run and after it loaded properly it shows wrong output. It's just showing two Hello World label, while MainPage.xaml does have button as well but that button is not displayed. I have attached output screenshot here:
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp1.MainPage">
<ScrollView>
<VerticalStackLayout Spacing="25" Padding="30">
<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level1"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />
<Label
Text="Current count: 0"
FontSize="18"
FontAttributes="Bold"
x:Name="CounterLabel"
HorizontalOptions="Center" />
<Button
Text="Click me"
FontAttributes="Bold"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center"
BackgroundColor="Orange" TextColor="White"/>
<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
WidthRequest="250"
HeightRequest="310"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
Does anyone know what is wrong here in the app? I have followed the steps mentioned in the MS Document which I have mentioned in the question.

Why does Ad Hoc build a different version of a Xamarin app than Visual Studio on Mac?

Here is the landing page for my application:
<ContentView x:Class="ThetaRex.OpenBook.Quant.Forms.Views.MainView"
xmlns:controls="clr-namespace:ThetaRex.OpenBook.Quant.Forms.Controls"
x:DataType="viewModels:MainViewModel"
xmlns:viewModels="clr-namespace:ThetaRex.OpenBook.Quant.Common.ViewModels;assembly=ThetaRex.OpenBook.Quant.Common"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns="http://xamarin.com/schemas/2014/forms">
<StackLayout>
<Label FontSize="Large"
HorizontalOptions="CenterAndExpand"
Margin="20,40,20,10"
Text="{x:Binding WelcomeLabel}"/>
<StackLayout Margin="20,0">
<ListView HasUnevenRows="True"
ItemsSource="{x:Binding Items}"
Margin="20,0">
<ListView.ItemTemplate>
<DataTemplate x:DataType="viewModels:FunctionItemViewModel">
<ViewCell>
<controls:DetailButton Command="{x:Binding Command}"
CommandParameter="{x:Binding CommandParameter}"
Description="{x:Binding Description}"
IsEnabled="{x:Binding IsEnabled}"
Label="{x:Binding Label}"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentView>
This is what it looks like when built on a Mac and built on Windows:
I built both using the exact same code and Visual Studio (Mac/Windows), then Archive to file, then load IPA using iTunes.
At no point did I ask for a scrollable window for the main stack layout, but the VS Windows seems to add that capability. Does anyone have a clue what's going on here?

Xamarin Forms Image source from URL gets cached?

I have some images on my FTP server which I want to display, my code in XAML is:
<Image x:Name="sponsor1" Source="http://website.com/web/image1.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="CenterAndExpand"/>
I recently changed the images on my FTP server, but my app (connected through USB and the app is ran by the IDE) is still displaying the old images that are no longer there.
Why is it doing it? is it caching? How do I disable it?
Yes, caching is enabled by default. To disable, set CachingEnabled="false"
<Image
HorizontalOptions="CenterAndExpand"
VerticalOptions ="CenterAndExpand">
<Image.Source>
<UriImageSource Uri="{Binding Image}"
CacheValidity="14"
CachingEnabled="true"/>
</Image.Source>
</Image>

ListView GroupHeaderTemplate with fixed height on iOS

I'm trying to set a variable height list view on iOS. Our code (on the sample project linked and main part below) works fine on Droid, but fails miserably on iOS.
I have tried iOS 9.3 and iOS 10, with forms 2.3.2.127 and latest prerelease 2.3.3.163-pre3.
<ListView Grid.Row="2"
ItemsSource="{Binding MenuSections}"
IsGroupingEnabled="True"
HasUnevenRows="True"
SeparatorVisibility="Default"
ItemTapped="ListViewOnItemTapped">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="15,10,15,10"
Spacing="0"
BackgroundColor="Green">
<Label Text="{Binding Name}"
LineBreakMode="TailTruncation"
TextColor="White"
FontSize="14"/>
<Label Text="{Binding Description}"
Margin="0,0,0,10"
IsVisible="{Binding HasDescription}"
LineBreakMode="WordWrap"
TextColor="{StaticResource BSDirtyWhite}"
FontSize="11"/>
</StackLayout>
</ViewCell>
</DataTemplate>
I have already removed everything above with only a Label, and got exactly same result. Looks like header height on iOS is fixed to some constant number.
Please find below the screen shots for Droid (working fine) and failed iOS 9.3 and 10.
Any help or workaround is greatly appreciated.
CodeKnox
Droid perfect header:
iOS 9 broken header:
iOS 10 broken header:
Sample project:
repro xamarin forms project
This bug is tracked on the Xamarin Forms Github site: https://github.com/xamarin/Xamarin.Forms/issues/3769
There is a gist in the comments suggesting creating a custom renderer:
https://gist.github.com/nbevans/a713dc9c77a8f530b6f4f3cd4fad83c2

Resources