I want to show GIF in my Xamarin forms app. I tried FFImageLoading but it shows GIF in android and iOS but not in UWP. So is there any way I can show GIF in UWP?
How to show Gif in UWP in Xamarin Forms?
As #agicandre1981 mentioned Basic GIF animation features will be merged, you could wait for the following update.
And UWP native image control supports GIF image, So you could use OnPlatform xaml tag to create different image control for per platform like the following.
<OnPlatform>
<On Platform="UWP">
<Image
HeightRequest="200"
HorizontalOptions="Center"
Source="test.gif"
VerticalOptions="Center"
WidthRequest="200"
/>
</On>
<On Platform="Android">
<ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center"
WidthRequest="300" HeightRequest="300"
DownsampleToViewSize="true"
Source = "Test.gif"/>
</On>
<On Platform="iOS">
<ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center"
WidthRequest="300" HeightRequest="300"
DownsampleToViewSize="true"
Source = "Test.gif"/>
</On>
</OnPlatform>
Related
I'm relatively new to Xamarin Forms. I'm trying to have a view that allows me to swipe left/right between different pages with a page indicator at the bottom. I'm using CarouselView, as suggested by the internet, and it seems to work. But, the selected page is very buggy. Sometimes, swiping to the next page causes it to snap back to the previous page. Sometimes, it stays on the current page. Sometimes, it works correctly. I observe the same behavior on both Android and UWP. Although, it appears to be a little worse in UWP than Android.
It seems the index for the current page is getting mixed up somehow. Here is my XAML:
<ContentPage.Content>
<StackLayout>
<CarouselView x:Name="Pages" IndicatorView="{x:Reference ActivePageIndicator}">
<CarouselView.ItemsSource>
<x:Array Type="{x:Type ContentView}">
<views:TroubleshootingPage />
<views:StatusPage />
<views:ContactInfoPage />
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<ContentView Content="{Binding .}" />
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<IndicatorView
x:Name="ActivePageIndicator"
IndicatorColor="LightGray"
SelectedIndicatorColor="Green"
IndicatorSize="16"
IndicatorsShape="Circle"
HorizontalOptions="Center"
Margin="4"
/>
</StackLayout>
</ContentPage.Content>
I've tried using different types of views in the ItemsSource list. But, I still get the same effect.
Is there something I'm doing wrong? Something I'm missing? A bug in CarouselView?
Thanks.
i am Using CardsView plugin 2.8.1 .its Working fine on Emulator and simulator but while check on Deployment it Frame show the wrong value section on carousel and few second after it show properly
Same Issue on While Scroll the Content or Refresh View
<RefreshView>
<CollectionView x:Name="CollView">
<CollectionView.ItemTemplate>
<DataTemplate>
<cards:CarouselView>
<cards:CarouselView.ItemTemplate>
<DataTemplate>
<Frame/>
</DataTemplate>
</cards:CarouselView.ItemTemplate>
</cards:CarouselView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</StackLayout> ```
I'm currently attempting to implement a Xamarin.Forms application which will be targeting Android TV. I have simplified my application to show the specific issue I'm having.
I have a collection of items which which I am displaying via a CollectionView. I am able to scroll around items inside this CollectionView using the D-Pad controls absolutely fine, as can be seen via this screenshot, where the "focussed"/"selected" item is visible if I make the layout bounds visible.
There is nothing available except the "ItemSelected" event on the CollectionView which only occurs on actually pressing enter. I have tried to add in "Focus" events to all the elements that make up this page and nothing gets triggered. I am unsure what exactly is being "focussed" upon here.
This is my page:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodels="clr-namespace:Channels.ViewModels"
x:Class="Channels.MainPage"
x:DataType="viewmodels:ChannelViewModel"
BackgroundColor="{DynamicResource BackgroundColour}">
<StackLayout Orientation="Vertical" Padding="10">
<Label Text="Selected Item" TextColor="White" Margin="0, 0, 10, 10"></Label>
<CollectionView ItemsSource="{Binding Data}">
<CollectionView.ItemsLayout>
<LinearItemsLayout ItemSpacing="5"></LinearItemsLayout>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Padding="5" Spacing="5" BackgroundColor="Red">
<Label Text="Test Text" HorizontalTextAlignment="Center" HorizontalOptions="FillAndExpand" TextColor="White"></Label>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</ContentPage>
I would like to know exactly what is getting focus here and if it is possible to do something like I have stated.
I haven't found many examples of Xamarin being used in terms of Android TV so it might not be possible to do things like this. I have also tried implementing the same code in .NET Maui and cannot find any events that might work here.
You could use the GestureRecognizers in the template to triger what you want to do when you selected the item or click on the item.
<Label>
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Label.GestureRecognizers>
</Label>
I have worked in the Appium testing tool (Version: 1.15.1), I am testing to Xamarin hybrid app (iOS and Android). I can select the view and also get xpath. But, In the list view, I am not able to select the child elements in the list view and also couldn’t find the xpath for child elements.
We have given automation id in source code. Even Appium inspector is not able to get elements. We used Xamarin.Form 4.3, 4.2, 3.5, and 3.0 versions.
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell AutomationId="MyViewCell" AutomationProperties.IsInAccessibleTree="True" >
<StackLayout Padding="10" AutomationProperties.IsInAccessibleTree="True" >
<Label x:Name="titleLbl" AutomationId="TitleLabel" Text="{Binding Text}" d:Text="{Binding .}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" AutomationProperties.IsInAccessibleTree="True" />
<Label x:Name="desc" AutomationId="DescLabel" Text="{Binding Description}" d:Text="Item descripton" LineBreakMode="NoWrap" Style="{DynamicResource ListItemDetailTextStyle}" FontSize="13" AutomationProperties.IsInAccessibleTree="True" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
Kindly give solutions for this problem.
Thanks.
I have added "**CarouselView.FormsPlugin.Abstractions.dll**" file to WindowsPhone platform in VisualStudio.
And In PCL, I have added the code for CarouselView as follows :
<Grid Grid.Row="0">
<carusalView:CarouselViewControl Orientation="Horizontal"
InterPageSpacing="10"
Position="0"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
x:Name="CarosoulItem"
ShowIndicators="False"
IndicatorsShape="Circle"
PageIndicatorTintColor="Yellow"
CurrentPageIndicatorTintColor="Green">
<carusalView:CarouselViewControl.ItemTemplate>
<DataTemplate>
<Image Source="{Binding Image}" HeightRequest="200" Aspect="AspectFill"/>
</DataTemplate>
</carusalView:CarouselViewControl.ItemTemplate>
</carusalView:CarouselViewControl>
</Grid>
In Android and IOS, Here also I have downloaded Carousel from Nuget Package Manager. Carousel is working here.
But, For Windows also I did Same thing. Here its not showing Carousel.
****NOTE:I am not using UWP.
So, please anyone find the solution for this?