Ejemplo n.º 1
0
        void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Page.TitleProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = TabbedPage.GetIndex(page);
                TabViewItems[index].Label = page.Title;
            }
            else if (e.PropertyName == Page.IconProperty.PropertyName)
            {
                var page = (Page)sender;

                var index = TabbedPage.GetIndex(page);
                TabViewItems[index].Label = page.Title;

                if (!string.IsNullOrEmpty(page.Icon))
                {
                    TabViewItems[index].Image = new NSImage(page.Icon);
                }
                else if (TabViewItems[index].Image != null)
                {
                    TabViewItems[index].Image = new NSImage();
                }
            }
        }
Ejemplo n.º 2
0
        void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Page.TitleProperty.PropertyName)
            {
                var page  = (Page)sender;
                var index = TabbedPage.GetIndex(page);
                TabViewItems[index].Label = page.Title;
            }
            else if (e.PropertyName == Page.IconImageSourceProperty.PropertyName)
            {
                var page = (Page)sender;

                var index = TabbedPage.GetIndex(page);
                var item  = TabViewItems[index];

                item.Label = page.Title;

                _ = this.ApplyNativeImageAsync(page, Page.IconImageSourceProperty, icon =>
                {
                    if (icon != null)
                    {
                        item.Image = icon;
                    }
                    else if (item.Image != null)
                    {
                        item.Image = new NSImage();
                    }
                });
            }
        }
Ejemplo n.º 3
0
        void SetSelectedTabViewItem()
        {
            if (Tabbed.CurrentPage == null)
            {
                return;
            }
            var selectedIndex = TabbedPage.GetIndex(Tabbed.CurrentPage);

            SelectedTabViewItemIndex = selectedIndex;
        }
Ejemplo n.º 4
0
        void SelectNextTab(int direction)
        {
            int nextIndex = TabbedPage.GetIndex(Tabbed.CurrentPage) + direction;

            if (nextIndex < 0 || nextIndex >= Tabbed.Children.Count)
            {
                return;
            }
            var nextPage = Tabbed.Children[nextIndex];

            Tabbed.CurrentPage = nextPage;
        }
Ejemplo n.º 5
0
        void SelectNextTab(int direction)
        {
            int nextIndex = TabbedPage.GetIndex(Tabbed.CurrentPage) + direction;

            if (nextIndex < 0 || nextIndex >= Tabbed.Children.Count)
            {
                return;
            }
            var nextPage = Tabbed.Children[nextIndex];

            UIView.Transition(Platform.GetRenderer(Tabbed.CurrentPage).NativeView, Platform.GetRenderer(nextPage).NativeView, 0.15, UIViewAnimationOptions.TransitionCrossDissolve, null);
            Tabbed.CurrentPage = nextPage;
        }
Ejemplo n.º 6
0
    void SelectNextTab(int direction)
    {
        int nextIndex = TabbedPage.GetIndex(Tabbed.CurrentPage) + direction;

        if (nextIndex < 0 || nextIndex >= Tabbed.Children.Count)
        {
            return;
        }
        var nextPage = Tabbed.Children[nextIndex];

        UIView.Transition(Platform.GetRenderer(Tabbed.CurrentPage).NativeView, Platform.GetRenderer(nextPage).NativeView, 0.15, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.LayoutSubviews | UIViewAnimationOptions.CurveLinear, null);

        Tabbed.CurrentPage = nextPage;
    }
Ejemplo n.º 7
0
        void CurrentTabbedPageOnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName != "CurrentPage")
            {
                return;
            }

            UpdateActionBar();

            // If we switch tabs while pushing a new page, UpdateActionBar() can set currentTabbedPage to null
            if (_currentTabbedPage == null)
            {
                return;
            }

            NavAnimationInProgress = true;

            Page page = _currentTabbedPage.CurrentPage;

            if (page == null)
            {
                ActionBar.SelectTab(null);
                NavAnimationInProgress = false;
                return;
            }

            int index = TabbedPage.GetIndex(page);

            if (ActionBar.SelectedNavigationIndex == index || index >= ActionBar.NavigationItemCount)
            {
                NavAnimationInProgress = false;
                return;
            }

            ActionBar.SelectTab(ActionBar.GetTabAt(index));

            NavAnimationInProgress = false;
        }
Ejemplo n.º 8
0
        void CurrentTabbedPageChildrenChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (CurrentTabbedPage == null)
            {
                return;
            }

            _ignoreAndroidSelection = true;

            e.Apply((o, index, create) => AddTab((Page)o, index), (o, index) => RemoveTab((Page)o, index), Reset);

            if (CurrentTabbedPage.CurrentPage != null)
            {
                Page page  = CurrentTabbedPage.CurrentPage;
                int  index = TabbedPage.GetIndex(page);
                if (index >= 0 && index < CurrentTabbedPage.Children.Count)
                {
                    ActionBar.GetTabAt(index).Select();
                }
            }

            _ignoreAndroidSelection = false;
        }
Ejemplo n.º 9
0
 protected override int GetIndex(Page page)
 {
     return(TabbedPage.GetIndex(page));
 }