public App() { var settingsNavigationPage = new Xamarin.Forms.NavigationPage(new SettingsPage()) { Icon = "Settings", Title = "Settings", BarBackgroundColor = Color.White, BarTextColor = Color.Black }; settingsNavigationPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().SetPrefersLargeTitles(true); var tabbedPage = new Xamarin.Forms.TabbedPage { Children = { new VotePage(), settingsNavigationPage } }; tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetBarItemColor(Color.Gray); tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetBarSelectedItemColor(Color.Black); MainPage = tabbedPage; }
public App() { FFImageLoading.ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration { HttpHeadersTimeout = 60 }); var tabbedPage = new Xamarin.Forms.TabbedPage { Title = "My Weather", BindingContext = new WeatherViewModel(), Children = { new WeatherView(), new ForecastView() } }; tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); if (Device.RuntimePlatform is Device.Android) { tabbedPage.BarBackgroundColor = Color.FromHex("1FAECE"); } var navigationPage = new Xamarin.Forms.NavigationPage(tabbedPage) { BarBackgroundColor = Color.FromHex("1FAECE"), BarTextColor = Color.White }; navigationPage.On <iOS>().SetPrefersLargeTitles(true); MainPage = navigationPage; }
public App() { InitializeComponent(); var visualChallengePage = new VisualChallengePage() { Icon = "home.png" }; var tabbedPage = new Xamarin.Forms.TabbedPage { Visual = VisualMarker.Material }; tabbedPage.Effects.Add(Effect.Resolve("VisualChallenge.NoShiftEffect")); tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); tabbedPage.Children.Add(visualChallengePage); NavigationPage.SetHasBackButton(visualChallengePage, false); tabbedPage.Children.Add(new ContentPage { Icon = "search.png" }); tabbedPage.Children.Add(new ContentPage { Icon = "bell.png" }); tabbedPage.Children.Add(new ContentPage { Icon = "message.png" }); MainPage = new MasterDetailPage() { Master = new MasterPage(), Detail = tabbedPage }; NavigationPage.SetHasNavigationBar(tabbedPage, false); }
private void CreateTabedPageAsRoot() { var tab1 = CreateTab1(); var tab2 = CreateTab2(); var tab3 = CreateTab3(); // The root page of your application _tabbedPage = new TabbedPage { Title = "Tab badge sample", Children = { tab1, tab2, tab3 } }; if (this._bootomPlacementSwitch.IsToggled) { _tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); } _tabbedPage.ToolbarItems.Add(new ToolbarItem("Item1", "tabicon.png", () => { }, ToolbarItemOrder.Primary)); MainPage = new NavigationPage(_tabbedPage); }
private void InitializeTabbed(TabPageInitializer[] pagesSet) { var tabbedPage = new TabbedPage(); tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); foreach (var item in pagesSet) { if (item.IsNavigationPage) { tabbedPage.Children.Add(new NavigationPage(GetInitializedPage(item.Page.ToString())) { Title = item.Title, Icon = item.Icon }); } else { var page = GetInitializedPage(item.Page.ToString()); page.Title = item.Title; page.Icon = item.Icon; tabbedPage.Children.Add(page); } } Application.Current.MainPage = tabbedPage; }
public App() { InitializeComponent(); var tabbedPage = new Xamarin.Forms.TabbedPage(); tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); tabbedPage.BarBackgroundColor = Color.White; tabbedPage.Children.Add(new MainPage() { Title = "标题", Icon = "Icon.png" }); tabbedPage.Children.Add(new MainPage() { Title = "标题", Icon = "Icon.png" }); tabbedPage.Children.Add(new MainPage() { Title = "标题", Icon = "Icon.png" }); tabbedPage.Children.Add(new MainPage() { Title = "标题", Icon = "Icon.png" }); tabbedPage.Children.Add(new MainPage() { Title = "标题", Icon = "Icon.png" }); MainPage = tabbedPage; }
void ConnectionButtonClique(object sender, EventArgs args) { var tabbedPage = new Xamarin.Forms.TabbedPage(); tabbedPage.Children.Add(new Localisation()); tabbedPage.Children.Add(new Paramètres()); tabbedPage.BarBackgroundColor = Color.White; tabbedPage.BackgroundColor = Color.White; tabbedPage.UnselectedTabColor = Color.FromHex("#5A5A5A"); tabbedPage.SelectedTabColor = Color.FromHex("#646BEB"); tabbedPage.BarTextColor = Color.FromHex("#5A5A5A"); tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); // Unsubscribe events MessagingCenter.Unsubscribe <BLEService, BLEDevice>(this, "deviceDiscovered"); MessagingCenter.Unsubscribe <BLEService>(this, "deviceConnected"); MessagingCenter.Unsubscribe <BLEService>(this, "deviceConnectionLost"); MessagingCenter.Unsubscribe <BLEService>(this, "deviceDisconnected"); MessagingCenter.Unsubscribe <BLEService, BluetoothStateChangedArgs>(this, "stateChanged"); MessagingCenter.Unsubscribe <BLEService>(this, "scanTimeoutElapsed"); MessagingCenter.Unsubscribe <BLEService>(this, "characteristicUpdated"); App.Current.MainPage = tabbedPage; }
public override void ApplyTabbedPageBehaviors(Xamarin.Forms.TabbedPage page) { base.ApplyTabbedPageBehaviors(page); page.SetValue(Xamarin.Forms.NavigationPage.BarBackgroundColorProperty, Color.DarkBlue); // Platform specific page.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); }
Page BuildRootView() { var barBackgroundColor = Color.FromHex("#2196F3"); var tabbed = new Xamarin.Forms.TabbedPage() { BarBackgroundColor = barBackgroundColor, BarTextColor = Color.White, UnselectedTabColor = Color.FromHex("#184d79"), SelectedTabColor = Color.White, }; //Free var freeViewModel = new FreeFontsViewModel(); var xamlFree = new XamlPage(freeViewModel); var codeFree = new CodePage(freeViewModel); var pages = new List <FontPageBase> { xamlFree, codeFree }; if (ProFontsLoaded()) { var proViewModel = new ProFontsViewModel(); var xamlPro = new XamlPage(proViewModel); var codePro = new CodePage(proViewModel); pages.Add(xamlPro); pages.Add(codePro); } pages.Add(new MiscPage()); foreach (var page in pages) { var nav = new NavigationPage(page) { BarBackgroundColor = barBackgroundColor, Title = page.Title, IconImageSource = new FontImageSource() { Glyph = page.Glyph, FontFamily = page.FontFamily, Size = Device.GetNamedSize(NamedSize.Medium, typeof(Xamarin.Forms.Button)) } }; tabbed.Children.Add(nav); } tabbed.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); return(tabbed); }
void SetSelectedTtitle() { var bottomNavMenuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView; for (int i = 0; i < bottomNavMenuView.ChildCount; i++) { var item = bottomNavMenuView.GetChildAt(i) as BottomNavigationItemView; var itemTitle = item.GetChildAt(1); var largeTextView = ((TextView)((BaselineLayout)itemTitle).GetChildAt(1)); lastItemId = bottomNavMenuView.SelectedItemId; largeTextView.SetTypeface(Typeface.Default, TypefaceStyle.Bold); //Set text color var textColor = (item.Id == bottomNavMenuView.SelectedItemId) ? tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarSelectedItemColor().ToAndroid() : tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarItemColor().ToAndroid(); largeTextView.SetTextColor(textColor); } }
public App() { InitializeComponent(); Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage(); tabbedPage.Children.Add(new LoginPage()); tabbedPage.Children.Add(new SignUpPage()); tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); MainPage = new NavigationPage(tabbedPage); //MainPage = new MainMasterDetailPage(); //MainPage = new NavigationPage( new ClientSearchPage() ); }
protected async Task ConfigureApplication(IServiceFactory container) { var tabbed = new Xamarin.Forms.TabbedPage(); tabbed.SelectedTabColor = Utility.PRIMARYBRIGHT_COLOR; tabbed.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); tabbed.Children.Add(CreateTab(container.GetInstance <HuntsView>(), "Jaktloggen", "Tabbar/gevir.png")); tabbed.Children.Add(CreateTab(container.GetInstance <SetupView>(), "Oppsett", "Tabbar/hunters.png")); tabbed.Children.Add(CreateTab(container.GetInstance <StatsView>(), "Statistikk", "Tabbar/stats.png")); tabbed.Children.Add(CreateTab(container.GetInstance <InfoView>(), "Info", "Tabbar/info.png")); _application.MainPage = tabbed; await Task.CompletedTask; }
//Change Tab font void ChangeFont() { var fontFace = Typeface.CreateFromAsset(Context.Assets, "gilsansultrabold.ttf"); var bottomNavMenuView = bottomNavigationView.GetChildAt(0) as BottomNavigationMenuView; for (int i = 0; i < bottomNavMenuView.ChildCount; i++) { var item = bottomNavMenuView.GetChildAt(i) as BottomNavigationItemView; var itemTitle = item.GetChildAt(1); var smallTextView = ((TextView)((BaselineLayout)itemTitle).GetChildAt(0)); var largeTextView = ((TextView)((BaselineLayout)itemTitle).GetChildAt(1)); lastItemId = bottomNavMenuView.SelectedItemId; smallTextView.SetTypeface(fontFace, TypefaceStyle.Bold); largeTextView.SetTypeface(fontFace, TypefaceStyle.Bold); //Set text color var textColor = (item.Id == bottomNavMenuView.SelectedItemId) ? tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarSelectedItemColor().ToAndroid() : tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().GetBarItemColor().ToAndroid(); smallTextView.SetTextColor(textColor); largeTextView.SetTextColor(textColor); } }
public App() { InitializeComponent(); Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage(); tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); // On<Xamarin.Forms.PlatformConfiguration.Android>).SetToolbarPlacement(ToolbarPlacement.Bottom); //var mainPage = new MainPage(); NavigationPage navigationPage = new NavigationPage(new MainPage()); navigationPage.IconImageSource = "phone_icon.ico"; navigationPage.Title = "Phone"; tabbedPage.Children.Add(navigationPage); tabbedPage.Children.Add(new WoundPage()); tabbedPage.Children.Add(new SmartWatchPage()); tabbedPage.Children.Add(new BluetoothList()); MainPage = tabbedPage; }
protected async override void OnAppearing() { base.OnAppearing(); ViewModels.SplashScreenViewModel splashScreenViewModel = new ViewModels.SplashScreenViewModel(); var isLoggedIn = await splashScreenViewModel.Login(); if (isLoggedIn) { App.Current.MainPage = new MainMasterDetailPage(); } else { Xamarin.Forms.TabbedPage tabbedPage = new Xamarin.Forms.TabbedPage(); tabbedPage.Children.Add(new LoginPage()); tabbedPage.Children.Add(new SignUpPage()); tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); App.Current.MainPage = new NavigationPage(tabbedPage); } }
private void CreateTabedPageWithNavigationPageChildren() { var tab1 = CreateTab1(); var tab2 = CreateTab2(); var tab3 = CreateTab3(); var tab1NavigationPage = new NavigationPage(tab1) { Title = tab1.Title, IconImageSource = tab1.IconImageSource }; var tab2NavigationPage = new NavigationPage(tab2) { Title = tab2.Title, IconImageSource = tab2.IconImageSource }; var tab3NavigationPage = new NavigationPage(tab3) { Title = tab3.Title, IconImageSource = tab3.IconImageSource }; // The root page of your application _tabbedPage = new TabbedPage { Title = "Tab badge sample", Children = { tab1NavigationPage, tab2NavigationPage, tab3NavigationPage, } }; if (this._bootomPlacementSwitch.IsToggled) { _tabbedPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); } MainPage = _tabbedPage; }
public App() { var navigationPage = new Xamarin.Forms.NavigationPage(new MySearchPage()) { Title = "Tab 1", BarBackgroundColor = Color.SteelBlue, BarTextColor = Color.Orange }; navigationPage.On <iOS>().SetPrefersLargeTitles(true); var tabbedPage = new Xamarin.Forms.TabbedPage { Children = { navigationPage, new DarkGrayContentPage { Title = "Tab 2" }, new DarkGrayContentPage { Title = "Tab 3" } } }; tabbedPage.On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); MainPage = new MasterDetailPage { Master = new ContentPage { Title = "☰", BackgroundColor = Color.LightGray }, Detail = tabbedPage }; }