I have implemented cardview inside of refreshview. RefreshView pullrefresh not working.
Using library https://github.com/AndreiMisiukevich/CardView/blob/master/docs/CardsView.md/
<RefreshView x:DataType="local:ItemsViewModel" Grid.Row="0" Grid.RowSpan="2" Command="{Binding LoadItemsCommand}" IsRefreshing="{Binding IsBusy, Mode=TwoWay}">
<!--https://github.com/AndreiMisiukevich/CardView/blob/master/docs/CardsView.md-->
<cards:CarouselView x:Name="ItemsListView" VerticalOptions="FillAndExpand"
IsHorizontalOrientation="False"
ItemsSource="{Binding RootData}"
IsCyclical="False"
ItemTemplate="{StaticResource RootSelector}" >
</cards:CarouselView>
</RefreshView>
Related
collectionview contains a label and StackLayout and its contents. The label is showing but StackLayout contents not showing and only if maximizes the windows it appears in UWP.this strange behaviour only occurring in uwp, not happening with ios or android. used xamarin.forms 5.0.0.2337
<CollectionView
ItemsSource="{Binding Details}"
SelectionMode="None"
>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="20,0"
RowDefinitions="auto,auto">
<Label Text="DateTime" IsVisible="{Binding IsDateVisible}" />
<StackLayout Orientation="Horizontal"
Grid.Row="1"
IsVisible="{Binding IsDateVisible}">
<DatePicker Date="{Binding DateValue, Mode=TwoWay}"
Format="MMMM dd, yy"
HorizontalOptions="Start"
MaximumDate="{x:Static sys:DateTime.Now}"
/>
<TimePicker Time="{Binding TimeValue, Mode=TwoWay}"
IsVisible="{Binding IsDateVisible}"
HorizontalOptions="Start"
/>
</StackLayout>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
StackLayout and its contents not showing inside a collectionview if maximizes the windows it appears in UWP with Xamarin.Forms
It looks know issue for CollectionView, please vote up this report and Keep an eye on the following update, currently the workaround is use listview to replace.
<ListView SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="20,0" RowDefinitions="auto,auto">
<Label IsVisible="true" Text="DateTime" />
<StackLayout
Grid.Row="1"
IsVisible="true"
Orientation="Horizontal">
<DatePicker
Format="MMMM dd, yy"
HorizontalOptions="Start"
MaximumDate="{x:Static sys:DateTime.Now}" />
<TimePicker HorizontalOptions="Start" IsVisible="true" />
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
I have a collectionview to populate list of data. But after binding the data, there is a large empty space at the bottom. As I'm using expander in the item template, I don't want to set the heightrequest. Any other workaround for this?
<CollectionView x:Name="cview_pendingtasks"
ItemsSource="{Binding PendingTasks, Mode=TwoWay}"
Margin="20, 5"
VerticalOptions="Center"
SelectionMode="None">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical" ItemSpacing="5" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Padding="0, 5"
BackgroundColor="Transparent" CornerRadius="10">
<Expander>
<Expander.Header>
///// Header goes here //////
</Expander.Header>
////////// Expander content ///////
</Expander>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
I am struggling to get my item centered in the carousel view, as simple as this sounds for same reason the item always starts at starts.
I need to display the items one at the time.
<StackLayout x:Name="innerStack"
HorizontalOptions="CenterAndExpand">
<Label Text="tesyt"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand"></Label>
<CarouselView HorizontalScrollBarVisibility="Never" BackgroundColor="Blue"
x:Name="carousel"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
HeightRequest="500"
> <CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="0"/>
</CarouselView.ItemsLayout>
<CarouselView.ItemsSource >
<x:Array Type="{x:Type Label}">
<Label Text="tesyt" TextColor="Green" Margin="10,0,0,0"
></Label>
<Label Text="tesyt" TextColor="Brown"></Label>
</x:Array>
</CarouselView.ItemsSource>
</CarouselView>
</StackLayout>
I am struggling to get my item centered in the carousel view。
If you want to set item center in carouselview, you can set HorizontalOptions="CenterAndExpand" and VerticalOptions="CenterAndExpand" for item in carouselview datatemplate.
And I find there are some error for carouselview.itemsource, you can refer to x:Array markup extension firstly, you can also take a look the following code:
<CarouselView
x:Name="carousel"
BackgroundColor="Blue"
HeightRequest="500"
HorizontalOptions="CenterAndExpand"
HorizontalScrollBarVisibility="Never"
VerticalOptions="CenterAndExpand">
<CarouselView.ItemsLayout>
<LinearItemsLayout ItemSpacing="20" Orientation="Horizontal" />
</CarouselView.ItemsLayout>
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>mono</x:String>
<x:String>monodroid</x:String>
<x:String>monotouch</x:String>
<x:String>monorail</x:String>
<x:String>monodevelop</x:String>
<x:String>monotone</x:String>
<x:String>monopoly</x:String>
<x:String>monomodal</x:String>
<x:String>mononucleosis</x:String>
</x:Array>
</CarouselView.ItemsSource>
<CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout>
<Frame
Margin="20"
BorderColor="Red"
CornerRadius="5"
HasShadow="True"
HeightRequest="50"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand">
<Label
HorizontalOptions="CenterAndExpand"
Text="{Binding .}"
VerticalOptions="CenterAndExpand" />
</Frame>
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
I have a view in Xaml and I am trying to use collection view as following
<CollectionView
x:Name="ColorCollectionView"
Margin="5"
HeightRequest="250"
WidthRequest="250"
ItemSizingStrategy="MeasureFirstItem"
ItemsSource="{Binding Categories}"
SelectedItem="{Binding SelectedCategory, Mode=OneWayToSource}"
SelectionChangedCommand="{Binding SelectedItemChangedCommand}"
SelectionChangedCommandParameter="{Binding Source={x:Reference ColorCollectionView}, Path=SelectedItem}"
SelectionMode="Single"
VerticalOptions="Center">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Horizontal" Span="2"
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Padding="20,0" Spacing="0">
<Frame Padding="10"
BackgroundColor="White"
BorderColor="{Binding
BackgroundSelectedColor}"
CornerRadius="100"
HasShadow="False">
<Image HeightRequest="60" Source="{Binding Image}"WidthRequest="60"/>
</Frame>
<Label FontFamily="{x:Static constants:Fonts.Medium}" FontSize="12" HorizontalOptions="Center" Text="{Binding Name}" TextColor="Black" /
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
and it works fine in android but I got this exception in iOSd
Managed Stacktrace:
at <unknown> <0xffffffff>
at ObjCRuntime.Messaging:nint_objc_msgSend_nint <0x0011f>
at UIKit.UICollectionView:NumberOfItemsInSection <0x0017a>
at Xamarin.Forms.Platform.iOS.GridViewLayout:NeedsPartialColumnAdjustment <0x00282> at
Xamarin.Forms.Platform.iOS.GridViewLayout:get_CollectionViewContentSize
This question already has an answer here:
Xamarin forms: Image is not showing in perfect circle
(1 answer)
Closed 4 years ago.
For the circle images, I am using Xam.Plugins.Forms.ImageCircle nuget package in my project, which is working fine in android and windows but showing an oval shape in IOS, screenshot adding below.
Added ImageCircleRenderer.Init(); in AppDelegate.cs
xmlns namespace added:
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
<ListView x:Name="MyTweetsTopics"
ItemsSource="{Binding AllItems,Mode=TwoWay}"
IsPullToRefreshEnabled="True"
HasUnevenRows="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Margin="5"
Padding="5"
Orientation="Horizontal">
<controls:CircleImage
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="50"
BorderColor="#1C7DB4"
Aspect="AspectFill"
BorderThickness="2"
HeightRequest="50">
<Image.Triggers>
<DataTrigger TargetType="Image" Binding="{Binding isProfileImageNull}" Value="True">
<Setter Property="Source" Value="dummy_profile.jpg"/>
</DataTrigger>
<DataTrigger TargetType="Image" Binding="{Binding isProfileImageNull}" Value="False">
<Setter Property="Source" Value="{Binding thumbnailImageUrl, Converter={StaticResource urlJoinConverter}}"/>
</DataTrigger>
</Image.Triggers>
<Image.GestureRecognizers>
<TapGestureRecognizer
Tapped="ShowTopicsProfile"
CommandParameter="{Binding .}"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</controls:CircleImage>
<StackLayout
HorizontalOptions="FillAndExpand"
Orientation="Vertical">
<StackLayout
HorizontalOptions="FillAndExpand"
Orientation="Horizontal">
<Label
Text="{Binding pageTitle}"
x:Name="pageTitle"
Font="Bold,17"
TextColor="Black"
HorizontalOptions="Start"
VerticalOptions="Center"/>
<StackLayout
Margin="0,10,0,0"
HorizontalOptions="EndAndExpand"
Orientation="Horizontal"
VerticalOptions="CenterAndExpand">
<Image
WidthRequest="20"
HeightRequest="20"
Margin="0,-5,0,0"
VerticalOptions="Center"
Source="ic_action_time.png"/>
<Label
Text="{Binding pageUpdatedDate, Converter={StaticResource cnvDateTimeConverter}}"
x:Name="tweetedTime"
Font="10"
Margin="-5,-5,0,0"
TextColor="Black"
HorizontalOptions="FillAndExpand"
VerticalOptions="Center"/>
</StackLayout>
</StackLayout>
<Label
Text="{Binding modifier.fullname, StringFormat='Last modified by {0:F0}'}"
Font="10"
TextColor="Black"
HorizontalOptions="Start"
VerticalOptions="Center"/>
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Footer>
<Label/>
</ListView.Footer>
</ListView>
Why in IOS only it is not working?
Thanks in advance
Could you give me your xml (listview) code so that I will able to solve your problem or if want to show Image from Cache you need to use FFImageLoading dll, it is available on nuget.
class CircleImage : CachedImage
{
public CircleImage()
{
LoadingPlaceholder = Glyphs.ImagePlaceholder;
ErrorPlaceholder = Glyphs.ImagePlaceholder;
DownsampleToViewSize = true;
Transformations = new List<FFImageLoading.Work.ITransformation>();
Transformations.Add(new CircleTransformation());
}
}
Use above control.