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

Custom view load in Carousel Page

$
0
0

Repost into this Forum after comment from Cheesebaron.

I have a custom view which is heavily based on the Karma meter created in the demo found here: developer.xamarin.com/guides/android/application_fundamentals/graphics_and_animation/

What I'd like to do is have this present in a Carousel Page. So my 'simple' intention is to have something like this:

Label title = new Label
{
    Text = "Karma Meter"
};

KarmaMeter _karmaMeter = new KarmaMeter();

MainPage = new CarouselPage
{
    Children = 
    {
        new ContentPage
        {
            Content = new StackLayout
            {
                Children =
                {
                    title,
                    _karmaMeter
                }
            }
        }
    }
}

The issue I have is that since the KarmaMeter extends View, it can't have a constructor that contains 0 arguments.

How do I need to define the custom view so that I can call it within the carousel page?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



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