예제 #1
0
        private async Task ShowSelection(int newTab)
        {
            if (newTab == selectionIndex)
            {
                return;
            }

            // navigate the selection pill
            var selectdTabLabel = tabHeaders[newTab];

            _ = SelectionUnderline.TranslateTo(selectdTabLabel.Bounds.X, 0, 150, easing: Easing.SinInOut);

            // update the style of the header to show it's selcted
            var unselectedStyle = (Style)Application.Current.Resources["TabLabel"];
            var selectedStyle   = (Style)Application.Current.Resources["SelectedTabLabel"];

            tabHeaders[selectionIndex].Style = unselectedStyle;
            selectdTabLabel.Style            = selectedStyle;

            /// reveal the contents
            await tabContents[selectionIndex].FadeTo(0);

            tabContents[selectionIndex].IsVisible = false;
            tabContents[newTab].IsVisible         = true;
            _ = tabContents[newTab].FadeTo(1); //ybadragon thanks!

            selectionIndex = newTab;
        }
예제 #2
0
        private async Task ShowSelection(int newTab)
        {
            // Don't do anything if the same tab is selected
            if (newTab == selectionIndex)
            {
                return;
            }

            // navigate the selection
            var selectedTab = tabHeaders[newTab];

            _ = SelectionUnderline.TranslateTo(selectedTab.Bounds.X, 0, 300, easing: Easing.SinInOut);

            // update the style of the header to show it's selcted
            var unselectedStyle = (Style)Application.Current.Resources["TabLabel"];
            var selectedStyle   = (Style)Application.Current.Resources["SelectedTabLabel"];

            tabHeaders[selectionIndex].Style = unselectedStyle;
            selectedTab.Style = selectedStyle;

            // Reveal the contents
            await tabContents[selectionIndex].FadeTo(0);

            tabContents[selectionIndex].IsVisible = false;
            tabContents[newTab].IsVisible         = true;
            _ = tabContents[newTab].FadeTo(1);

            selectionIndex = newTab;

            GetPlantNotes(_viewModel.Id);
        }
예제 #3
0
        private async Task UpdateSelection(int newIndex)
        {
            // Ignore selection on the same selected tab
            if (newIndex == selectedIndex)
            {
                return;
            }

            // Get the selected tab
            var selectedTabLabel = tabHeaders[newIndex];

            // Translate the selection underline
            _ = SelectionUnderline.TranslateTo(selectedTabLabel.Bounds.X, 0, 150, easing: Easing.SinInOut);

            // Apply a fade effect on the old content to hide
            await tabContents[selectedIndex].FadeTo(0);

            // Hide the content of the unselected tab
            tabContents[selectedIndex].IsVisible = false;

            // Display the content of the selected tab
            tabContents[newIndex].IsVisible = true;

            // Apply a fade effect on the new content to be displayed
            _ = tabContents[newIndex].FadeTo(1);

            selectedIndex = newIndex;
        }