private void Page_SizeChanged(object sender, SizeChangedEventArgs e) { ViewState = ApplicationView.Value; if (ViewState == ApplicationViewState.Snapped) { if (Page.TopAppBar != null) { topBar = Page.TopAppBar; Page.TopAppBar = null; } if (Page.BottomAppBar != null) { bottomBar = Page.BottomAppBar; Page.BottomAppBar = null; } } else if (topBar != null || bottomBar != null) { Page.TopAppBar = topBar; Page.BottomAppBar = bottomBar; topBar = null; bottomBar = null; } OnApplicationViewStateChanged(); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///CommentPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (TheBellyofAuthority.Common.LayoutAwarePage)this.FindName("pageRoot"); commentBar = (Windows.UI.Xaml.Controls.AppBar)this.FindName("commentBar"); DeleteButton = (Windows.UI.Xaml.Controls.Button)this.FindName("DeleteButton"); EditButton = (Windows.UI.Xaml.Controls.Button)this.FindName("EditButton"); commentThread = (Windows.UI.Xaml.Controls.ListView)this.FindName("commentThread"); commentLabel = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("commentLabel"); commentBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("commentBox"); postButton = (Windows.UI.Xaml.Controls.Button)this.FindName("postButton"); backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle"); UserPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("UserPanel"); progBar = (Windows.UI.Xaml.Controls.ProgressBar)this.FindName("progBar"); LabelBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("LabelBox"); UserBox = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("UserBox"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); }
void CodePage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Current = this; AppBar timeTracker = new AppBar(); var homeButton = new Button(); homeButton.Name = "btnHome"; homeButton.Click += HomeButton_Click; homeButton.Content = "Home"; var sPanel = new StackPanel(); sPanel.Children.Add(homeButton); timeTracker.Background = new SolidColorBrush(new Color { A = 33, R = 118, G = 15, B = 5 }); var ttControl = new TimeTrackerControl(); ttControl.CPRStartTime = CurrentCode.CPRStartTime.ToString(@"MM/dd/yyyy H\:mm"); sPanel.Children.Add(ttControl); timeTracker.Content = sPanel; timeTracker.IsOpen = true; timeTracker.IsSticky = true; this.TopAppBar = timeTracker; if (CurrentDefibrillation.Resuscitations == null) { CurrentDefibrillation.Resuscitations = new List<Resuscitation>(); } }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (ContosoCookbook.Common.LayoutAwarePage) this.FindName("pageRoot"); itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource"); PageAppBar = (Windows.UI.Xaml.Controls.AppBar) this.FindName("PageAppBar"); LeftCommands = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("LeftCommands"); RightCommands = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("RightCommands"); BragButton = (Windows.UI.Xaml.Controls.Button) this.FindName("BragButton"); PinRecipeButton = (Windows.UI.Xaml.Controls.Button) this.FindName("PinRecipeButton"); flipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView"); portraitFlipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("portraitFlipView"); snappedFlipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("snappedFlipView"); backButton = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState) this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { // Preserve the app bar appBar = rootPage.BottomAppBar; // this ensures the app bar is not shown in this scenario rootPage.BottomAppBar = null; }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { // Preserve the app bar appBar = rootPage.BottomAppBar; // this ensures the app bar is not shown in this scenario rootPage.BottomAppBar = null; ToggleButtons(SecondaryTile.Exists(MainPage.dynamicTileId)); }
/// <summary> /// Initializes a new instance of the <see cref="GlobalPage"/> class. /// </summary> public GlobalPage() { // Create the global appbar globalAppBar = new AppBar(); globalAppBar.Content = new AppbarContent(); globalAppBar.Background = Application.Current.Resources["AddBarBackgroundBrush"] as SolidColorBrush; globalAppBar.Opened += globalAppBar_Opened; this.BottomAppBar = globalAppBar; }
void FlatNavigationPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Current = this; AppBar appBar = new AppBar(); appBar.Content = new FlatNavigationControl(); this.TopAppBar = appBar; LinearGradientBrush myLinearGradientBrush = new LinearGradientBrush(); myLinearGradientBrush.StartPoint = new Point(0, 0); myLinearGradientBrush.EndPoint = new Point(1, 1); GradientStop gradientStop = new GradientStop(); myLinearGradientBrush.GradientStops.Add(new GradientStop() { Color = Colors.AliceBlue, Offset = 0 }); myLinearGradientBrush.GradientStops.Add(new GradientStop() { Color = Colors.Magenta, Offset = 1 }); this.Background = myLinearGradientBrush; }
public static void ShowRelativeToAppBar(Popup popup, Page page, AppBar appbar, Button button) { Func<UIElement, UIElement, Point> getOffset = delegate(UIElement control1, UIElement control2) { return control1.TransformToVisual(control2).TransformPoint(new Point(0, 0)); }; Point popupOffset = getOffset(popup, page); Point buttonOffset = getOffset(button, page); popup.HorizontalOffset = buttonOffset.X - popupOffset.X - (popup.ActualWidth / 2) + (button.ActualWidth / 2); popup.VerticalOffset = getOffset(appbar, page).Y - popupOffset.Y - popup.ActualHeight; if (popupOffset.X + popup.HorizontalOffset + popup.ActualWidth > page.ActualWidth) { popup.HorizontalOffset = page.ActualWidth - popupOffset.X - popup.ActualWidth; } else if (popup.HorizontalOffset + popupOffset.X < 0) { popup.HorizontalOffset = -popupOffset.X; } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Principal.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); tbAhorcado = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbAhorcado"); imgAhorcado = (Windows.UI.Xaml.Controls.Image)this.FindName("imgAhorcado"); tbPalabra = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbPalabra"); txtLetra = (Windows.UI.Xaml.Controls.TextBox)this.FindName("txtLetra"); tbPuntos = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbPuntos"); barra = (Windows.UI.Xaml.Controls.AppBar)this.FindName("barra"); tbUsadas = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbUsadas"); btnResolver = (Windows.UI.Xaml.Controls.Button)this.FindName("btnResolver"); popupfin = (Windows.UI.Xaml.Controls.Primitives.Popup)this.FindName("popupfin"); popupsexo = (Windows.UI.Xaml.Controls.Primitives.Popup)this.FindName("popupsexo"); tbMensaje = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbMensaje"); menubar = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("menubar"); btnJ1 = (Windows.UI.Xaml.Controls.Button)this.FindName("btnJ1"); }
public void Initialize(Page rootPage) { // Instansiate AppBar var appBarGrid = new Grid(); appBarGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Auto) }); appBarGrid.ColumnDefinitions.Add(new ColumnDefinition()); appBarGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(0, GridUnitType.Auto) }); // Instansiate StackPanel leftItems_ = new StackPanel() { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Left }; rightItems_ = new StackPanel() { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right }; // Insert StackPanels to Grid appBarGrid.Children.Add(leftItems_); appBarGrid.Children.Add(rightItems_); Grid.SetColumn(rightItems_, 1); // Create MenuItems Popup Button menuButton_ = MakeAppBarButton(null, ""); menuButton_.Content = "…"; menuButton_.Click += ShowContextMenuClick; appBarGrid.Children.Add(menuButton_); Grid.SetColumn(menuButton_, 2); // Set Grid to AppBar appBar_ = new AppBar(); appBar_.Content = appBarGrid; appBar_.Background = new SolidColorBrush(BackgroundColor); appBar_.Opacity = Opacity; // Set AppBar rootPage.BottomAppBar = appBar_; // Attach Events PropertyChanged += ApplicationBarPropertyChanged; Buttons.CollectionChanged += ApplicationBarButtonsCollectionChanged; MenuItems.CollectionChanged += ApplicationBarMenuItemsCollectionChanged; Buttons.All(_ => { _.PropertyChanged += ButtonPropertyChanged; return true; }); MenuItems.All(_ => { _.PropertyChanged += MenuItemPropertyChanged; return true; }); // Create MenuButtons foreach (var button in Buttons) { var b = MakeAppBarButton(button.IconUri, button.Text); b.Click += (s, e) => { button.OnClick(); }; rightItems_.Children.Add(b); } // Hide Three dots button UpdateContextMenuButtonVisibility(); // Set flag initialized_ = true; }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { // Save original AppBar so we can restore it afterward originalAppBar = rootPage.BottomAppBar; // Use a CommandBar rather than an AppBar so that we get default layout CommandBar commandBar = new CommandBar(); // Create the 'Add' button AppBarButton add = new AppBarButton(); add.Label = "Add"; add.Icon = new SymbolIcon(Symbol.Add); commandBar.PrimaryCommands.Add(add); // Create the 'Remove' button AppBarButton remove = new AppBarButton(); remove.Label = "Remove"; remove.Icon = new SymbolIcon(Symbol.Remove); commandBar.PrimaryCommands.Add(remove); commandBar.PrimaryCommands.Add(new AppBarSeparator()); // Create the 'Delete' button AppBarButton delete = new AppBarButton(); delete.Label = "Delete"; delete.Icon = new SymbolIcon(Symbol.Delete); commandBar.PrimaryCommands.Add(delete); // Create the 'Camera' button AppBarButton camera = new AppBarButton(); camera.Label = "Camera"; camera.Icon = new SymbolIcon(Symbol.Camera); commandBar.SecondaryCommands.Add(camera); // Create the 'Bold' button AppBarButton bold = new AppBarButton(); bold.Label = "Bold"; bold.Icon = new SymbolIcon(Symbol.Bold); commandBar.SecondaryCommands.Add(bold); // Create the 'Italic' button AppBarButton italic = new AppBarButton(); italic.Label = "Italic"; italic.Icon = new SymbolIcon(Symbol.Italic); commandBar.SecondaryCommands.Add(italic); // Create the 'Underline' button AppBarButton underline = new AppBarButton(); underline.Label = "Underline"; underline.Icon = new SymbolIcon(Symbol.Underline); commandBar.SecondaryCommands.Add(underline); // Create the 'Align Left' button AppBarButton left = new AppBarButton(); left.Label = "Align Left"; left.Icon = new SymbolIcon(Symbol.AlignLeft); commandBar.SecondaryCommands.Add(left); // Create the 'Align Center' button AppBarButton center = new AppBarButton(); center.Label = "Align Center"; center.Icon = new SymbolIcon(Symbol.AlignCenter); commandBar.SecondaryCommands.Add(center); // Create the 'Align Right' button AppBarButton right = new AppBarButton(); right.Label = "Align Right"; right.Icon = new SymbolIcon(Symbol.AlignRight); commandBar.SecondaryCommands.Add(right); rootPage.BottomAppBar = commandBar; }
public AppBarEvents(AppBar This) : base(This) { this.This = This; }
protected override void OnWindowShow() { base.OnWindowShow(); OverlayProgressBar.IsIndeterminate = true; var page = GetPage(); if (page != null) { _originalAppBar = page.BottomAppBar; page.BottomAppBar = null; } }
public void SetBottomAppBar(AppBar bar, Guid pageId) { BottomAppBar = bar; curPageId = pageId; }
/// <summary> /// Initializes a new instance of the <see cref="HideWhenSnappedHandler"/> class. /// </summary> /// <param name="appBar">The app bar.</param> public HideWhenSnappedHandler(AppBar appBar) { Attach(appBar); }
private async void UpdateActionBar(bool isSourceZoomedInView) { if (isSourceZoomedInView) { topBar = Page.TopAppBar; Page.TopAppBar = null; bottomBar = Page.BottomAppBar; Page.BottomAppBar = null; backupShowSearchPaneOnKeyboardInput = SearchPane.GetForCurrentView().ShowOnKeyboardInput; SearchPane.GetForCurrentView().ShowOnKeyboardInput = false; Groups = await Query.GetSemanticZoomTabs(); } else { Page.BottomAppBar = bottomBar; Page.TopAppBar = topBar; SearchPane.GetForCurrentView().ShowOnKeyboardInput = backupShowSearchPaneOnKeyboardInput; } }
public async Task Start(Page page, Canvas container, AppBar detailAppBar, string id) { this.page = page; this.printContainer = container; this.appBar = detailAppBar; this.RegisterForPrinting(); await this.LoadDate_RunTime(id); this.SetupAppBarForSecondaryTiles(); }
private void ThisPopupOnOpened(object sender, object o) { lock (_locker) { _listOfWindows.Add(this); _isOpen = true; _currentPage = PageHelper.GetCurrentPage(); if (_currentPage != null) { if (_currentPage.BottomAppBar != null) { _pageAppBarState = _currentPage.BottomAppBar; _currentPage.BottomAppBar = null; } } } OnUi.RunAsync(OnWindowShow); }
private void RemoveDismissListners(AppBar app) { if (app != null) { app.Closed -= DismissPopup; app.Opened -= DismissPopup; } }
private Rect GetRectAppBar(AppBar app) { var appBarPosition = app.TransformToVisual(null).TransformPoint(new Point(0, 0)); return new Rect(appBarPosition, app.RenderSize); }
private void AddDismissListners(AppBar app) { if (app != null) { app.Closed += DismissPopup; app.Opened += DismissPopup; } }
public void BindForegroundColor(AppBar appBar) { SetAppBarForegroundBinding(appBar); }
private void Attach(AppBar appBar) { _appBar = appBar; Window.Current.SizeChanged += WindowSizeChanged; _appBar.Unloaded += OnAppBarUnloaded; UpdateAppBarVisibility(); }
private void UpdateAppBar(AppBar appbar) { var height = 0d; if (appbar == null) height = 0d; else if (appbar.Visibility == Visibility.Collapsed) height = 0d; else if (appbar.IsOpen) height = ((appbar.Content as FrameworkElement)?.ActualHeight ?? appbar.ActualHeight); else height = appbar.ActualHeight; PaneContent.Margin = new Thickness(PaneContent.Margin.Left, PaneContent.Margin.Top, PaneContent.Margin.Right, height); PaneContent.InvalidateMeasure(); }
internal void Detach() { Window.Current.SizeChanged -= WindowSizeChanged; _appBar.Unloaded -= OnAppBarUnloaded; _appBar = null; }
public void Show(Page page, AppBar appbar, Button button) { SearchPopup.IsOpen = true; FlyoutHelper.ShowRelativeToAppBar(SearchPopup, page, appbar, button); }
/// <summary> /// Sets the BottomAppBar property. This dependency property /// indicates the bottom app bar to set on the page for the control on which this property is defined. /// </summary> public static void SetBottomAppBar(DependencyObject d, AppBar value) { d.SetValue(BottomAppBarProperty, value); }