Exemplo n.º 1
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                Page.PagesChanged -= OnPagesChanged;
            }

            if (e.NewElement != null)
            {
                var newPage = e.NewElement as CarouselPage;

                if (newPage == null)
                {
                    throw new ArgumentException("New element must be a CarouselPage");
                }

                if (Widget == null)
                {
                    Widget          = new Carousel();
                    Widget.Animated = true;

                    var eventBox = new GtkFormsContainer();
                    eventBox.Add(Widget);
                    Control.Content = eventBox;
                }

                Init();
            }
        }
Exemplo n.º 2
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                NavigationController.PushRequested             -= OnPushRequested;
                NavigationController.PopRequested              -= OnPopRequested;
                NavigationController.PopToRootRequested        -= OnPopToRootRequested;
                NavigationController.RemovePageRequested       -= OnRemovedPageRequested;
                NavigationController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
            }

            if (e.NewElement != null)
            {
                if (Widget == null)
                {
                    Widget = new Fixed();
                    var eventBox = new GtkFormsContainer();
                    eventBox.Add(Widget);

                    Control.Content = eventBox;
                }

                UpdateBackgroundImage();
                Init();
            }
        }
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                if (Widget == null)
                {
                    // There is nothing similar in Gtk.
                    // Custom control has been created that simulates the expected behavior.
                    Widget = new Controls.MasterDetailPage();
                    var eventBox = new GtkFormsContainer();
                    eventBox.Add(Widget);

                    Control.Content = eventBox;

                    Widget.IsPresentedChanged += OnIsPresentedChanged;

                    UpdateMasterDetail();
                    UpdateMasterBehavior();
                    UpdateIsPresented();
                    UpdateBarTextColor();
                    UpdateBarBackgroundColor();
                }
            }
        }
Exemplo n.º 4
0
 private void RefreshContent(GtkFormsContainer newContent)
 {
     _contentContainer.RemoveFromContainer(_content);
     _content = newContent;
     _contentContainer.Add(_content);
     _content.ShowAll();
 }
Exemplo n.º 5
0
        private void BuildPage()
        {
            _defaultBackgroundColor = Style.Backgrounds[(int)StateType.Normal];

            _toolbar = new HBox();
            _content = new GtkFormsContainer();

            var root = new VBox(false, 0);

            _headerContainer = new GtkFormsContainer();
            root.PackStart(_headerContainer, false, false, 0);

            _image        = new ImageControl();
            _image.Aspect = ImageAspect.Fill;

            _contentContainerWrapper = new GtkFormsContainer();
            _contentContainerWrapper.SizeAllocated += OnContentContainerWrapperSizeAllocated;
            _contentContainer = new Fixed();
            _contentContainer.Add(_image);
            _contentContainerWrapper.Add(_contentContainer);

            root.PackStart(_contentContainerWrapper, true, true, 0);             // Should fill all available space

            Attach(root, 0, 1, 0, 1);

            ShowAll();
        }
Exemplo n.º 6
0
 private void RefreshContent(GtkFormsContainer newContent)
 {
     _content.Destroy();
     _content = newContent;
     _contentContainer.Add(_content);
     _content.ShowAll();
 }
Exemplo n.º 7
0
 public override void Destroy()
 {
     base.Destroy();
     if (_contentContainerWrapper != null)
     {
         _contentContainerWrapper.SizeAllocated -= OnContentContainerWrapperSizeAllocated;
         _contentContainerWrapper = null;
     }
     _contentContainer = null;
     _image            = null;
     _toolbar          = null;
     _content          = null;
     _headerContainer  = null;
 }