- Home
- Forum
- Xamarin.Forms
- ArgumentOutOfRangeExeption when using SfCircularGauge.Headers
ArgumentOutOfRangeExeption when using SfCircularGauge.Headers
Hi,
Attachment: Screenshot_20191004_at_20.57.18_be801c8f.zip
I'm using the SfCircularGauge control, within a ListView. The source of the ListView is using a Binded property. Everything works fine, however when the Binding Model is updated and the PropertyUpdated event fires, I get an ArgumentOutOfRangeException (stack trace attached).
This is the code I am using:
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell IsEnabled="false">
<Grid RowSpacing="2" Margin="10" ColumnSpacing="20" Padding="10,10,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<gauge:SfCircularGauge VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Grid.RowSpan="4" WidthRequest="80" HeightRequest="80" >
<gauge:SfCircularGauge.Headers>
<gauge:Header Text="{Binding TotalRemaining}" Position="0.5, 0.45" ForegroundColor="#0682F6" FontAttributes="Bold" TextSize="13"/>
<gauge:Header Text="REMAINING" Position="0.5, 0.625" ForegroundColor="#0682F6" FontAttributes="Bold" TextSize="6"/>
</gauge:SfCircularGauge.Headers>
<gauge:SfCircularGauge.Scales>
<gauge:Scale SweepAngle="360" ShowTicks="False" ShowRim="False" ShowLabels="False" EndValue="{Binding Total}">
<gauge:Scale.Ranges>
<gauge:Range Offset="1" StartValue="0" EndValue="{Binding Total}" Color="#27ae60"/>
<gauge:Range Offset="1" StartValue="{Binding TotalPrayed}" EndValue="{Binding Total}" Color="#e74c3c"/>
</gauge:Scale.Ranges>
</gauge:Scale>
</gauge:SfCircularGauge.Scales>
</gauge:SfCircularGauge>
<Label Grid.RowSpan="3" Grid.Column="1" Margin="10" FontSize="25" FontAttributes="Bold" Text="{Binding Name}" TextColor="Black" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
Please can you assist - Is it a bug or am I implementing it incorrectly?
Attachment: Screenshot_20191004_at_20.57.18_be801c8f.zip
SIGN IN To post a reply.
3 Replies
VR
Vignesh Ramesh
Syncfusion Team
October 9, 2019 02:43 PM UTC
Hi Shakil,
Greetings from Syncfusion.
We have analyzed the reported problem in our end and would like to inform that, it is due to old Element’s object are not disposed properly in ListView. You can overcome this problem by setting CachingStrategy as RecycleElement as like below snippet.
[XAML]:
|
<ListView ItemsSource="{Binding ItemsSource}" Grid.Row="1" CachingStrategy="RecycleElement" RowHeight="120"> |
Please find the sample for the same from the below link.
Regards,
Vignesh.
SM
Shakil Mohammed
October 9, 2019 09:34 PM UTC
Perfect, that has worked, thank you!
RA
Rachel A
Syncfusion Team
October 10, 2019 05:28 AM UTC
Hi Shakil,
Thanks for the confirmation.
Please let us know if you have any other queries.
Thanks,
Rachel.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
SM Shakil Mohammed
- Oct 4, 2019 07:59 PM UTC
- Oct 10, 2019 05:28 AM UTC