public static Button AddButton(this ViewGroup parent, string text) { var button = parent.Add <Button>(); button.Text = text; return(button); }
private static TextView AddDollarText(ViewGroup parent) { var dollarText = parent.Add <TextView>(); dollarText.Text = "$"; dollarText.SetTextColor(Colors.Green); dollarText.TextSize = 8; return(dollarText); }
public static TextView AddTextView(this ViewGroup parent, string text, Color background, Color textColor) { var textView = parent.Add <TextView>(); textView.Text = text; textView.SetBackgroundColor(background); textView.SetTextColor(textColor); textView.Gravity = GravityFlags.CenterHorizontal; return(textView); }
public override View Run() { var viewgroup = new ViewGroup() { BackgroundColor = Tizen.NUI.Color.Red }; viewgroup.LayoutUpdated += (s, e) => { var blockSize = viewgroup.Size.Height / viewgroup.Children.Count; var currentTop = 0f; foreach (var child in viewgroup.Children) { child.UpdateBounds(new Tizen.UIExtensions.Common.Rect(0, currentTop, viewgroup.Size.Width, blockSize)); Thread.Sleep(100); currentTop += blockSize; } }; var button = new Button { Text = "Add" }; var removeButton = new Button { Text = "Remove" }; viewgroup.Children.Add(button); viewgroup.Children.Add(removeButton); viewgroup.Children.Add(new View { BackgroundColor = Tizen.NUI.Color.Yellow }); button.Clicked += (s, e) => { var rnd = new Random(); var view = new View(); view.UpdateBackgroundColor(Tizen.UIExtensions.Common.Color.FromRgb(rnd.Next(10, 255), rnd.Next(10, 255), rnd.Next(10, 255))); viewgroup.Add(view); }; removeButton.Clicked += (s, e) => { var last = viewgroup.Children.Last(); viewgroup.Remove(last); last.Dispose(); }; return(viewgroup); }
public override View Run() { _navigationDrawer = new TVNavigationDrawer(); _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 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); }
public override View Run() { var drawerView = new FocusDisabledDrawerView(); drawerView.DrawerShadow = new Shadow(30.0f, Tizen.NUI.Color.Red, new Vector2(10, 0)); drawerView.Toggled += (s, e) => { Console.WriteLine($"drawerView toggled!!!"); }; var viewGroup = new ViewGroup(); viewGroup.BackgroundColor = Tizen.NUI.Color.Yellow; viewGroup.LayoutUpdated += (s, e) => { var blockSize = viewGroup.Size.Height / viewGroup.Children.Count; var currentTop = 0f; foreach (var child in viewGroup.Children) { child.UpdateBounds(new Tizen.UIExtensions.Common.Rect(0, currentTop, viewGroup.Size.Width, blockSize)); currentTop += blockSize; } }; var openButton = new Button { Text = "Open" }; var closeButton = new Button { Text = "Close" }; var modeButton = new Button { Text = $"IsPopover={drawerView.IsPopover}" }; var behaviorButton = new Button { Text = $"Behavior : {drawerView.DrawerBehavior}" }; openButton.Clicked += (s, e) => { _ = drawerView.OpenAsync(false); }; closeButton.Clicked += (s, e) => { _ = drawerView.CloseAsync(false); }; modeButton.Clicked += (s, e) => { drawerView.IsPopover = !drawerView.IsPopover; modeButton.Text = $"IsPopover={drawerView.IsPopover} \n IsOpened={drawerView.IsOpened}"; }; behaviorButton.Clicked += (s, e) => { if (drawerView.DrawerBehavior == Tizen.UIExtensions.Common.DrawerBehavior.Drawer) { drawerView.DrawerBehavior = Tizen.UIExtensions.Common.DrawerBehavior.Locked; } else if (drawerView.DrawerBehavior == Tizen.UIExtensions.Common.DrawerBehavior.Locked) { drawerView.DrawerBehavior = Tizen.UIExtensions.Common.DrawerBehavior.Disabled; } else { drawerView.DrawerBehavior = Tizen.UIExtensions.Common.DrawerBehavior.Drawer; } behaviorButton.Text = $"hange behavior : {drawerView.DrawerBehavior}"; }; viewGroup.Children.Add(openButton); viewGroup.Children.Add(closeButton); viewGroup.Children.Add(modeButton); viewGroup.Children.Add(behaviorButton); var naviView = new ViewGroup { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; naviView.BackgroundColor = Tizen.NUI.Color.Cyan; var shadowButton = new Button { Text = $"shadow = {(drawerView.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)); drawerView.DrawerShadow = (drawerView.DrawerShadow == null) ? shadow : null; shadowButton.Text = $"shadow = {(drawerView.DrawerShadow != null)}"; }; naviView.Add(shadowButton); drawerView.Content = viewGroup; drawerView.Drawer = naviView; return(drawerView); }