Beispiel #1
0
 private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
 {
     if (NavigationDrawer != null)
     {
         if (NavigationDrawer.IsOpen)
         {
             NavigationDrawer.ToggleDrawer();
         }
         else
         {
             NavigationDrawer.ToggleDrawer();
         }
     }
 }
Beispiel #2
0
 void hamburgerButton_Clicked(object sender, EventArgs e)
 {
     NavigationDrawer.ToggleDrawer();
 }
        public override View Run()
        {
            _navigationDrawer = new NavigationDrawer();
            _navigationDrawer.DrawerShadow = new Shadow(30.0f, Tizen.NUI.Color.Red, new Vector2(10, 0));
            _navigationDrawer.Toggled     += (s, e) =>
            {
                Console.WriteLine($"drawerView toggled!!!");
            };

            _navigationDrawer.Content          = CreateContent();
            _navigationDrawer.IsGestureEnabled = false;

            var backdrop = new ViewGroup();

            backdrop.BackgroundColor = Tizen.NUI.Color.Blue;
            //backdrop.Opacity = 0.5f;
            _navigationDrawer.Backdrop = backdrop;

            var naviView = new ViewGroup
            {
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.MatchParent,
            };

            naviView.BackgroundColor = Tizen.NUI.Color.Cyan;

            naviView.LayoutUpdated += (s, e) =>
            {
                var blockSize  = naviView.Size.Height / naviView.Children.Count;
                var currentTop = 0f;
                foreach (var child in naviView.Children)
                {
                    child.UpdateBounds(new Tizen.UIExtensions.Common.Rect(0, currentTop, naviView.Size.Width, blockSize));
                    currentTop += blockSize;
                }
            };

            var shadowButton = new Button
            {
                Text = $"shadow = {(_navigationDrawer.DrawerShadow != null)}",
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };

            shadowButton.Clicked += (s, e) =>
            {
                var shadow = new Shadow(30.0f, Tizen.NUI.Color.Red, new Vector2(10, 0));
                _navigationDrawer.DrawerShadow = (_navigationDrawer.DrawerShadow == null) ? shadow : null;
                shadowButton.Text = $"shadow = {(_navigationDrawer.DrawerShadow != null)}";
            };


            var contentButon = new Button
            {
                Text = "content",
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };

            contentButon.Clicked += (s, e) =>
            {
                _navigationDrawer.Content = CreateContent();
            };

            var newContentButon = new Button
            {
                Text = "new content",
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };

            newContentButon.Clicked += (s, e) =>
            {
                _navigationDrawer.Content = new View
                {
                    BackgroundColor     = Color.White,
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = LayoutParamPolicies.MatchParent,
                };
            };

            var scrollableContentButton = new Button
            {
                Text = "scroll content",
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };

            scrollableContentButton.Clicked += (s, e) =>
            {
                var test    = new ScrollViewTest1();
                var content = test.Run();
                content.WidthSpecification  = LayoutParamPolicies.MatchParent;
                content.HeightSpecification = LayoutParamPolicies.MatchParent;
                _navigationDrawer.Content   = content;
            };

            var backdropButton = new Button
            {
                Text = "backdrop",
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
            };

            backdropButton.Clicked += (s, e) =>
            {
                var backdrop = new ViewGroup();
                backdrop.BackgroundColor   = Tizen.NUI.Color.Red;
                backdrop.Opacity           = 0.5f;
                _navigationDrawer.Backdrop = backdrop;
            };

            naviView.Add(shadowButton);
            naviView.Add(contentButon);
            naviView.Add(newContentButon);
            naviView.Add(scrollableContentButton);
            naviView.Add(backdropButton);

            _navigationDrawer.Drawer = naviView;

            return(_navigationDrawer);
        }
Beispiel #4
0
 public void ClickNavigationDrawer()
 {
     NavigationDrawer.Click();
 }
Beispiel #5
0
 public App(string filePath)
 {
     InitializeComponent();
     MainPage = new NavigationDrawer();
     FilePath = filePath;
 }
Beispiel #6
0
 public App()
 {
     InitializeComponent();
     MainPage = new NavigationDrawer();
 }
Beispiel #7
0
 private void OnParentChanged(InteractiveObject target, Transform newParent)
 {
     NavigationDrawer = newParent == null
                         ? null : newParent.gameObject.GetComponentInParent <NavigationDrawer>();
 }