Hi guys, I posted another question about aCarouselPage
app but unfortunately there was no response. I persevered and managed to fix the things I asked about.
I'm now a bit lost with the CarouselPage
. My code in App.GetMainPage
is like this:
return new CarouselPage {
Children =
{
new ContentPage {BackgroundImage = "BgImage1"},
new ContentPage {BackgroundImage = "BgImage2", Content = new StackLayout {Children = {MainStackLayout}}},
new ContentPage {BackgroundImage = "BgImage3"},
new ContentPage {BackgroundImage = "BgImage4"},
new ContentPage {BackgroundImage = "BgImage5"},
new ContentPage {BackgroundImage = "BgImage6"},
new ContentPage {BackgroundImage = "BgImage7"},
new ContentPage {BackgroundImage = "BgImage8"},
new ContentPage {BackgroundImage = "BgImage9"}
}
}
I have omitted MainStackLayout
but it contains buttons that act as tabs, when each is clicked the body text changes.
For each ContentPage
I need 4 buttons and 4 lots of body content, so for 9 ContentPage
s I'd need 9 * 8 elements declared in my GetMainPage
function. Should I be doing this with XAML instead?
I'm stuck with how exactly I know which ContentPage
is currently active. If I knew which page was active I could set the content dynamically and make use of a Dictionary
or something.
It just seems wrong to have declare all the elements in the code before intialising the ContentPage
, I think it limits what I can then do on each page in terms of event handlers and such as I have no idea which content page is active if coded like above.
I think I need a better example of a CarouselPage
, the only one I could find was in FormsGallery
and it is relatively simple.