Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Why does my oxyplot not display within a stacklayout?

$
0
0

Hi Guys, I am hoping someone can give me a point in the right direction.

I have the following page:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Project.Views.ChartPage"
             xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
             >
  <oxy:PlotView Model="{Binding OxyPlotModel}" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

with a viewmodel bound with an existing plotmodel created in the constructor of said viewmodel

 public class ChartPageViewModel
    {
        public PlotModel OxyPlotModel { get; set; }

        public ChartPageViewModel()
        {
            OxyPlotModel = new PlotModel() { Title = "TestTestTest"};
        }
    }

My problem is that when I wrap the PlotView in a stacklayout, in order to add other controls to the page, it is not displayed anymore. Everything works fine as the code is displayed above, but adding a stacklayout:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Project.Views.ChartPage"
             xmlns:oxy="clr-namespace:OxyPlot.Xamarin.Forms;assembly=OxyPlot.Xamarin.Forms"
             >
  <StackLayout>
    <oxy:PlotView Model="{Binding OxyPlotModel}" VerticalOptions="Center" HorizontalOptions="Center" />
  </StackLayout>
</ContentPage>

removes any sign that the chart exists.

Can anyone point out what (if anything) I am doing wrong, and if what I am trying to do is not supported, how I should go about having a chart and other controls on the same page?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>