Bug 56836 - OxyPlot Bar Chart inside a listview control for Xamarin.Forms
Summary: OxyPlot Bar Chart inside a listview control for Xamarin.Forms
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-05-25 12:57 UTC by Naveen Gogineni
Modified: 2017-05-26 13:58 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Naveen Gogineni 2017-05-25 12:57:39 UTC
I have a ListView with a binding template. And I have a list of PlotModels which I am using to bind to the list view.
And my PlotView is inside the template where I am binding the PlotModel to the PlotView.

Everything is running smooth in Android. But the problem is I am getting a error "PlotModel is already in use by some other PlotView control.".
when I am trying to run it on IOS.
Comment 1 Paul DiPietro [MSFT] 2017-05-25 13:01:05 UTC
We will need more details about what you are trying to do, but this description and error makes me wonder if you've first contacted the OxyPlot library developers first to see if they have any advice?
Comment 2 Naveen Gogineni 2017-05-26 05:48:35 UTC
As per your comment I am adding my code. Please check it.

//My content page
public MyConstructor()
	List<MyChart> charts = new List<MyChart>();
	charts.Add(new MyChart { PlotModel = PlotModel1 });
	charts.Add(new MyChart { PlotModel = PlotModel2 });
	charts.Add(new MyChart { PlotModel = PlotModel3 });
	charts.Add(new MyChart { PlotModel = PlotModel4 });
	ListView lvPlots = new ListView(ListViewCachingStrategy.RetainElement)
		ItemsSource = charts,
		ItemTemplate = new DataTemplate(typeof(NewDashboardSubCell)),
		HasUnevenRows = true
	Content = lvPlots;

public class MyChart
       public MyPlotModel PlotModel { get; set; }

//My View Cell
public class NewDashboardSubCell : ViewCell
        PlotView plotView;
        public NewDashboardSubCell()
                plotView = new PlotView
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    IsVisible = true,
                    IsEnabled = true,
                    HeightRequest = App.ScreenHeight - 100,
                    WidthRequest = App.ScreenWidth - 40

                plotView.SetBinding(PlotView.ModelProperty, "PlotModel");

                View = plotView;                
            catch (Exception ex)

On using this code I am getting the above mentioned error only on IOS Platform.
Comment 3 Paul DiPietro [MSFT] 2017-05-26 13:58:27 UTC
This code doesn't say much by itself. As mentioned, if the error explicitly has to do with OxyPlot (which I have not used before), as it seems based on that error, then I would suggest reaching out to the OxyPlot developers to get their feedback first and reopen this is they can pinpoint an error in Forms itself. For future reference, we strongly prefer complete reproduction projects opposed to pasted code snippets.