0

I can't seem to bind correctly to Oxyplot in Xamarin. I had a read through multiple posts, but couldn't figure out what's wrong with my setup.

XAML

<ContentPage.BindingContext>
    <local:MainViewModel />
</ContentPage.BindingContext>

<ContentPage.Content>
    
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="500" />
        </Grid.RowDefinitions>

        <oxy:PlotView Grid.Row="0" Model="{Binding CandlestickPlotModel}" Background="Green"/>
        
    </Grid>
    
</ContentPage.Content>

ViewModel

class MainViewModel
{
    public PlotModel CandlestickPlotModel { get; set; }

    public MainViewModel()
    {
        CandlestickPlotModel = new PlotModel();

        CandlestickPlotModel.Title = "Title";
        CandlestickPlotModel.Background = OxyColors.LightBlue;
    }
}

When I run, I get a green box, but I would expect a light blue box if the binding would work. Can anyone see what's wrong with this code?

christian.stock
  • 181
  • 2
  • 15

1 Answers1

0

Figured it out. Nothing wrong with the Binding. Oxyplot 1.0 and Xamarin Forms and UWP isn't supported. Installing Oxyplot.Xamarin.Forms 1.1.0-unstable fixes the issue.

christian.stock
  • 181
  • 2
  • 15