public App() { var navigationPage = new Xamarin.Forms.NavigationPage(new MyContentPage()); navigationPage.On<iOS>().SetPrefersLargeTitles(true); MainPage = navigationPage; }
public void NavigateAsync_ToContentPage_ByName() { var navigationService = new PageNavigationServiceMock(_container); var rootPage = new Xamarin.Forms.NavigationPage(); ((IPageAware)navigationService).Page = rootPage; navigationService.Navigate("ContentPage", useModalNavigation: false); Assert.True(rootPage.Navigation.NavigationStack.Count == 1); Assert.IsType(typeof(ContentPageMock), rootPage.Navigation.NavigationStack[0]); }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var item = e.SelectedItem as Models.MenuItem; if (item == null) { return; } //var page = (Xamarin.Forms.NavigationPage)Activator.CreateInstance(item.TargetType); var page = (Xamarin.Forms.Page)Activator.CreateInstance(item.TargetType); page.Title = item.Title; Detail = new Xamarin.Forms.NavigationPage(page); (Detail as Xamarin.Forms.NavigationPage).On <Xamarin.Forms.PlatformConfiguration.iOS> ().SetPrefersLargeTitles(true); IsPresented = false; masterPage.ListView.SelectedItem = null; }
public NTabbedPageBottom() { On <Android>().DisableSwipePaging(); On <Android>().SetOffscreenPageLimit(4); On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); var firstPage = new NavigationPage(new FirstPage()) { Title = "Page1" }; firstPage.IconImageSource = new FontImageSource { FontFamily = "materialdesignicons", Glyph = FontIcons.BookOpenVariant, }; firstPage.IconImageSource.SetAppThemeColor(FontImageSource.ColorProperty, Color.Black, Color.White); var secondPage = new NavigationPage(new SecondPage()) { Title = "Page2" }; secondPage.IconImageSource = new FontImageSource { FontFamily = "materialdesignicons", Glyph = FontIcons.BookOpenVariant, }; secondPage.IconImageSource.SetAppThemeColor(FontImageSource.ColorProperty, Color.Black, Color.White); var thirdPage = new NavigationPage(new ThirdPage()) { Title = "Page3" }; thirdPage.IconImageSource = new FontImageSource { FontFamily = "materialdesignicons", Glyph = FontIcons.BookOpenVariant, }; thirdPage.IconImageSource.SetAppThemeColor(FontImageSource.ColorProperty, Color.Black, Color.White); Children.Add(firstPage); Children.Add(secondPage); Children.Add(thirdPage); }
public App() { InitializeComponent(); var page = new Xamarin.Forms.NavigationPage(new MainPage()) { BarTextColor = Color.White }; var ios = page.On <iOS>(); ios.SetUseSafeArea(true); ios.SetPrefersLargeTitles(true); ios.SetLargeTitleDisplay(LargeTitleDisplayMode.Always); MainPage = page; }
public App() { InitializeComponent(); if (Device.RuntimePlatform == Device.iOS) { MainPage = new Xamarin.Forms.NavigationPage(new InputSamples()) { BarBackgroundColor = Color.FromHex("#9D2235"), BarTextColor = Color.White }; } else { MainPage = new Xamarin.Forms.NavigationPage(new InputSamples()) { BarBackgroundColor = Color.FromHex("#9E9E9E"), BarTextColor = Color.White }; } }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var item = e.SelectedItem as MasterDetailPageTestMenuItem; if (item == null) { return; } var page = (Page)Activator.CreateInstance(item.TargetType); page.Title = item.Title; Detail = new Xamarin.Forms.NavigationPage(page); IsPresented = false; MasterPage.ListView.SelectedItem = null; }
public AppBootstrapper() { Locator.CurrentMutable.InitializeSplat(); Locator.CurrentMutable.InitializeReactiveUI(); RegisterServices(); RegisterViews(); IViewShell mainView = new ViewShell(RxApp.TaskpoolScheduler, RxApp.MainThreadScheduler, ViewLocator.Current); _navigationPage = mainView as Xamarin.Forms.NavigationPage; IViewStackService viewStackService = new ViewStackService(mainView); Locator.CurrentMutable.RegisterConstant(viewStackService, typeof(IViewStackService)); viewStackService .PushPage(new LoginViewModel(viewStackService)) .Subscribe(); }
public App() { // The root page of your application /*MainPage = new ContentPage * { * Content = new StackLayout * { * VerticalOptions = LayoutOptions.Center, * Children = { * new Label { * HorizontalTextAlignment = TextAlignment.Center, * Text = "Welcome to Xamarin Forms!" * } * } * } * };*/ MainPage = new Xamarin.Forms.NavigationPage(new SignInPage()); }
public async Task PushModalAsync(NavigationViewModel viewModel, bool animate = false) { try { var oldViewModel = (NavigationViewModel)NavigationPage?.CurrentPage.BindingContext; var view = InstantiateView(viewModel); // Most likely we're going to want to put this into a navigation page so we can have a title bar on it var nv = new NavigationPage((Page)view); await FormsNavigation.PushModalAsync(nv, animate); oldViewModel?.OnHidden(); } catch { // ignored as non critical exceptions don't stop the app from working } }
public NTabbedPage() { var firstPage = new NavigationPage(new FirstPage()) { Title = "Page1" }; firstPage.IconImageSource = new FontImageSource { FontFamily = "materialdesignicons", Glyph = FontIcons.BookOpenVariant, }; firstPage.IconImageSource.SetAppThemeColor(FontImageSource.ColorProperty, Color.Black, Color.White); var secondPage = new NavigationPage(new SecondPage()) { Title = "Page2" }; secondPage.IconImageSource = new FontImageSource { FontFamily = "materialdesignicons", Glyph = FontIcons.BookOpenVariant, }; secondPage.IconImageSource.SetAppThemeColor(FontImageSource.ColorProperty, Color.Black, Color.White); var thirdPage = new NavigationPage(new ThirdPage()) { Title = "Page3" }; thirdPage.IconImageSource = new FontImageSource { FontFamily = "materialdesignicons", Glyph = FontIcons.BookOpenVariant, }; thirdPage.IconImageSource.SetAppThemeColor(FontImageSource.ColorProperty, Color.Black, Color.White); Children.Add(firstPage); Children.Add(secondPage); Children.Add(thirdPage); }
public iOSStatusBarTextColorModePageCS(ICommand restore) { var returnButton = new Button { Text = "Return to Platform-Specifics List" }; returnButton.Clicked += (sender, e) => restore.Execute(null); Master = new ContentPage { Title = "Master Page Title" }; Detail = new Xamarin.Forms.NavigationPage(new ContentPage { Content = new StackLayout { Margin = new Thickness(20), Children = { new Label { Text = "Slide the master page to see the status bar text color mode change." }, returnButton } } }); ((Xamarin.Forms.NavigationPage)Detail).BarBackgroundColor = Color.Blue; ((Xamarin.Forms.NavigationPage)Detail).BarTextColor = Color.White; IsPresentedChanged += (sender, e) => { var mdp = sender as MasterDetailPage; if (mdp.IsPresented) { ((Xamarin.Forms.NavigationPage)mdp.Detail).On <iOS>().SetStatusBarTextColorMode(StatusBarTextColorMode.DoNotAdjust); } else { ((Xamarin.Forms.NavigationPage)mdp.Detail).On <iOS>().SetStatusBarTextColorMode(StatusBarTextColorMode.MatchNavigationBarTextLuminosity); } }; }
public SearchPage() { NavigationPage.SetBackButtonTitle(this, ""); BindingContext = viewmodel = new SearchPageViewModel(); InitializeComponent(); On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); GetCategories(); SearchBar.SearchCommand = new Command(async() => { var locations = dataService.SearchLocations(SearchBar.Text); var locationsViewModel = new ResultsViewModel { Locations = locations }; await Navigation.PushAsync(new LocationsPage(locationsViewModel)); }); }
public RecordVoicePage(int dialogId, MessagesManager messagesManager) { this.dialogId = dialogId; this.messagesManager = messagesManager; NavigationPage.SetHasNavigationBar(this, false); recordButton.On <TizenConfig>().SetStyle(ButtonStyle.Circle); absoluteLayout.Children.Add(hint, new Rectangle(0.5, 0.2, 200, 200), AbsoluteLayoutFlags.PositionProportional); absoluteLayout.Children.Add(recordButton, new Rectangle(0.5, 0.5, 75, 75), AbsoluteLayoutFlags.PositionProportional); absoluteLayout.Children.Add(sendButton, new Rectangle(0.5, 0.9, 200, 60), AbsoluteLayoutFlags.PositionProportional); absoluteLayout.Children.Add(activityIndicator); Content = absoluteLayout; audioRecorder.RecordingLimitReached += OnRecordingLimitReached; recordButton.Clicked += OnRecordButtonPressed; sendButton.Clicked += OnSendButtonPressed; PrivilegeChecker.PrivilegeCheck("http://tizen.org/privilege/recorder"); PrivilegeChecker.PrivilegeCheck("http://tizen.org/privilege/mediastorage"); }
public MainPage() { try { Master = new SlidingPage(); Detail = new Xamarin.Forms.NavigationPage(new LandingPage()) { BarBackgroundColor = Color.FromHex("#b85921"), BarTextColor = Color.White }; CoreSettings.AppNav = Detail.Navigation; MainPage.CurrentDetail = Detail; } catch (Exception ex) { var x = ex.Message; } this.SetBinding(MasterDetailPage.IsPresentedProperty, new Binding("IsPresented", BindingMode.TwoWay)); }
void ListMenu_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var menu = e.SelectedItem as Menu; if (menu != null) { IsPresented = false; //El menú hamburguesa se esconde if (menu.MenuTitle == "Cerrar Sesión") { this.Navigation.PushModalAsync(new MainPage()); } else { Detail = new Xamarin.Forms.NavigationPage(menu.Page) { BarBackgroundColor = Color.FromHex("#033E8C"), BarTextColor = Color.White }; } } }
public TGBasePage() { InitializeComponent(); if (Init.ClearBackButtonTextOnAllPages) { NavigationPage.SetBackButtonTitle(this, string.Empty); } // set default busy overlay content IsBusyOverlayContent = Init.CustomActivityIndicator; // get value for SafeAreaInsets if (Device.RuntimePlatform == Device.iOS) { SafeAreaInsets = On <Xamarin.Forms.PlatformConfiguration.iOS>().SafeAreaInsets(); // 20 or 40 px depending on phone type } else { SafeAreaInsets = new Thickness(); // we don't care about this on Android } }
public App() { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("OTg4NzhAMzEzNzJlMzEyZTMwZ3doZFZhZHRhbjRuMnU3TkpGWTFvSjNLbk5ZZmt1Z0c0OUFJUDJKRGVjcz0="); if (Device.RuntimePlatform == Device.iOS) { IsDeviceIphone = DependencyService.Get <IDeviceInfo>().IsIphoneXDevice(); } InitializeComponent(); Xamarin.Forms.NavigationPage navigationPage; Xamarin.Forms.Page pageType = new LandingPage(); navigationPage = new Xamarin.Forms.NavigationPage(pageType) { BarTextColor = Color.White, BarBackgroundColor = Color.FromHex("#AF1E2D"), }; GetFontSize(); Locator.NavigationService.Initialize(navigationPage); UserEmail = String.Empty; Password = String.Empty; if (!Current.Properties.ContainsKey("IsUserLoggedIn")) { Current.Properties["IsUserLoggedIn"] = false; Xamarin.Forms.Application.Current.SavePropertiesAsync(); MainPage = navigationPage; } else { if (Convert.ToBoolean(Current.Properties["IsUserLoggedIn"]) == true) { MainPage = new Xamarin.Forms.NavigationPage(new HomePage()); } else { MainPage = navigationPage; } } }
public App() { InitializeComponent(); var navPage = new Xamarin.Forms.NavigationPage(new MainPage()) { BarBackgroundColor = Color.DarkSlateBlue, BarTextColor = Color.White }; navPage.On <iOS>().SetPrefersLargeTitles(true); MainPage = navPage; AppCenter.Start(AppConstants.AppCenterKey, typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push)); Push.PushNotificationReceived += OnPushRecieved; }
public App() { InitializeComponent(); var style = new Style(typeof(Label)); style.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = NamedSize.Small }); var fontFile = "sourcesanspro-semibold.ttf"; var fontName = "Source Sans Pro Semibold"; var boldFontFile = "sourcesanspro-bold.ttf"; var boldFontName = "Source Sans Pro Bold"; var regularFontFamily = GetFontFamilyForPlatform(Device.RuntimePlatform, fontName, fontFile); style.Setters.Add(new Setter { Property = Label.FontFamilyProperty, Value = regularFontFamily }); var boldFontFamily = GetFontFamilyForPlatform(Device.RuntimePlatform, boldFontName, boldFontFile); style.Triggers.Add(new Trigger(typeof(Label)) { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold, Setters = { new Setter { Property = Label.FontFamilyProperty, Value = boldFontFamily } } }); Resources.Add(style); //MainPage = new NavigationPage(new Transactions()); MainPage = new NavigationPage(new MainPage()); }
void OnItemSelected(object sender, SelectedItemChangedEventArgs e) { var item = e.SelectedItem as MasterPageItem; if (item != null) { var page = (Xamarin.Forms.Page)Activator.CreateInstance(item.TargetType); //page.On<iOS>().EnableTranslucentNavigationBar(); //page.On<iOS>().SetPrefersLargeTitles(true); if (page is TranslucentPage) { Detail = new Xamarin.Forms.NavigationPage(page); } else { Detail = page; } masterPage.listviewitems.SelectedItem = null; IsPresented = false; } }
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 }; }
public App() { Device.SetFlags(new[] { "Markup_Experimental" }); 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 async Task NavigateFromMenu(int id) { if (Device.RuntimePlatform == Device.macOS && id == (int)MenuItemType.About) { DisplayAlert("About", @"Xamarin.Forms sample for Agora SDK Proudly presented by Agora and DreamTeam Mobile https://agora.io https://drmtm.us", "OK"); return; } if (!_menuPages.ContainsKey(id)) { switch (id) { case (int)MenuItemType.Call: _menuPages.Add(id, new NavigationPage(new ConnectPage())); break; case (int)MenuItemType.About: _menuPages.Add(id, new NavigationPage(new AboutPage())); break; } } NavigationPage newPage = _menuPages[id]; if (newPage != null && Detail != newPage) { Detail = newPage; if (Device.RuntimePlatform == Device.Android) { await Task.Delay(100); //auto-hide menu on Android } IsPresented = false; } }
public TabbedMainPage(IAnalyticsService analyticsService) { this.analyticsService = analyticsService; var viewCreator = (TinyMvvmViewCreator)((FormsNavigationHelper)NavigationHelper.Current).ViewCreator; mainPage = viewCreator.Create(typeof(ContributionsPage)); profilePage = viewCreator.Create(typeof(ProfilePage)); navigationMainPage = new Xamarin.Forms.NavigationPage(mainPage); navigationProfilePage = new Xamarin.Forms.NavigationPage(profilePage); var fontIcon = (string)Xamarin.Forms.Application.Current.Resources["font_icon"]; On <iOS>().SetTranslucencyMode(TranslucencyMode.Opaque); On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom); navigationMainPage.IconImageSource = new FontImageSource() { FontFamily = fontIcon, Glyph = Icons.home, Size = 20 }; navigationProfilePage.IconImageSource = new FontImageSource() { FontFamily = fontIcon, Glyph = Icons.settings, Size = 20 }; navigationMainPage.Title = Translations.tabs_activities; navigationProfilePage.Title = Translations.tabs_settings; Children.Add(navigationMainPage); Children.Add(navigationProfilePage); }
public static Page GenerateTabPage() { var bottomBarPage = new CustomTabbedNavigation() { BarBackgroundColor = (Color)Application.Current.Resources["BottomTabBackground"] }; bottomBarPage.AddTab <ContactListTabPageModel>(AppResources.Contacts, Device.RuntimePlatform == Device.iOS ? "1.png" : "tab1.png"); bottomBarPage.AddTab <RemindersTabPageModel>(AppResources.Reminders, Device.RuntimePlatform == Device.iOS ? "2.png" : "tab2.png"); bottomBarPage.AddTab <OpportunityTabPageModel>(AppResources.Opportunities, Device.RuntimePlatform == Device.iOS ? "3.png" : "tab3.png"); bottomBarPage.AddTab <NotificationsTabPageModel>(AppResources.Notifications, Device.RuntimePlatform == Device.iOS ? "4.png" : "tab4.png"); bottomBarPage.AddTab <PlusTabPageModel>(AppResources.More, Device.RuntimePlatform == Device.iOS ? "5.png" : "tab5.png"); currentPage = new NavigationPage(bottomBarPage) { BarTextColor = Color.White }; currentPage.On <Xamarin.Forms.PlatformConfiguration.iOS>().HideNavigationBarSeparator(); return(currentPage); }
public object ProvideValue( IServiceProvider serviceProvider ) { var result = new Xamarin.Forms.NavigationPage( Root ); return result; }
public App() { InitializeComponent(); MainPage = new NavigationPage(new StartPage()); }
public PlatformSpecificsPageCS() { var blurButton = new Button { Text = "Blur Effect (iOS only)" }; blurButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSBlurEffectPageCS()); var largeTitleButton = new Button { Text = "Large Title Display (iOS only)" }; largeTitleButton.Clicked += (sender, e) => { var navigationPage = new Xamarin.Forms.NavigationPage(new iOSLargeTitlePageCS(new Command(RestoreOriginal))); navigationPage.On <iOS>().SetPrefersLargeTitles(true); SetRoot(navigationPage); }; var safeAreaButton = new Button { Text = "Safe Area Layout Guide (iOS only)" }; safeAreaButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSSafeAreaPageCS()); var translucentButton = new Button { Text = "Translucent Navigation Bar (iOS only) " }; translucentButton.Clicked += (sender, e) => SetRoot(new Xamarin.Forms.NavigationPage(new iOSTranslucentNavigationBarPageCS(new Command(RestoreOriginal)))); var entryButton = new Button { Text = "Entry Font Size Adjusts to Text Width (iOS only)" }; entryButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSEntryPageCS()); var hideStatusBarButton = new Button { Text = "Hide Status Bar (iOS only) " }; hideStatusBarButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSStatusBarPageCS()); var pickerUpdateModeButton = new Button { Text = "Picker UpdateMode (iOS only)" }; pickerUpdateModeButton.Clicked += async(sender, e) => await Navigation.PushAsync(new iOSPickerPageCS()); var scrollViewButton = new Button { Text = "ScrollView DelayContentTouches (iOS only)" }; scrollViewButton.Clicked += (sender, e) => SetRoot(new iOSScrollViewPageCS(new Command(RestoreOriginal))); var statusBarTextColorModeButton = new Button { Text = "Navigation Page Status Bar Text Color Mode (iOS only)" }; statusBarTextColorModeButton.Clicked += (sender, e) => SetRoot(new iOSStatusBarTextColorModePageCS(new Command(RestoreOriginal))); var inputModeButton = new Button { Text = "Soft Input Mode Adjust (Android only)" }; inputModeButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidSoftInputModeAdjustPageCS()); var lifecycleEventsButton = new Button { Text = "Pause and Resume Lifecycle Events (Android only)" }; lifecycleEventsButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidLifecycleEventsPageCS()); var tabbedPageSwipeButton = new Button { Text = "Tabbed Page Swipe (Android only)" }; tabbedPageSwipeButton.Clicked += (sender, e) => SetRoot(new AndroidTabbedPageSwipePageCS(new Command(RestoreOriginal))); var listViewFastScrollButton = new Button { Text = "ListView FastScroll (Android only)" }; listViewFastScrollButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidListViewFastScrollPageCS()); var elevationButton = new Button { Text = "Elevation (Android only)" }; elevationButton.Clicked += async(sender, e) => await Navigation.PushAsync(new AndroidElevationPageCS()); var tabbedPageButton = new Button { Text = "Tabbed Page Toolbar Location Adjust (Windows only)" }; tabbedPageButton.Clicked += (sender, e) => SetRoot(new WindowsTabbedPageCS(new Command(RestoreOriginal))); var navigationPageButton = new Button { Text = "Navigation Page Toolbar Location Adjust (Windows only)" }; navigationPageButton.Clicked += (sender, e) => SetRoot(new WindowsNavigationPageCS(new Command(RestoreOriginal))); var masterDetailPageButton = new Button { Text = "Master Detail Page Toolbar Location Adjust (Windows only)" }; masterDetailPageButton.Clicked += (sender, e) => SetRoot(new WindowsMasterDetailPageCS(new Command(RestoreOriginal))); Title = "Platform Specifics Demo"; Content = new Xamarin.Forms.ScrollView { Content = new StackLayout { Margin = new Thickness(20), Children = { blurButton, largeTitleButton, safeAreaButton, translucentButton, entryButton, hideStatusBarButton, pickerUpdateModeButton, scrollViewButton, statusBarTextColorModeButton, inputModeButton, lifecycleEventsButton, tabbedPageSwipeButton, listViewFastScrollButton, elevationButton, tabbedPageButton, navigationPageButton, masterDetailPageButton } } }; }
public CustomTabbedNavigation(string navigationServiceName) { NavigationPage.SetHasNavigationBar(this, false); NavigationServiceName = navigationServiceName; RegisterNavigation(); }
protected BaseContentPage() { NavigationPage.SetHasNavigationBar(this, false); On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); }
private async void LaunchCalendarClicked(object sender, EventArgs e) { var page = new Xamarin.Forms.NavigationPage(new CalendarGridView()); await Application.Current.MainPage.Navigation.PushModalAsync(page, true); }