public override View Run() { var view = new View { Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, } }; var menu = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal }, SizeHeight = 200, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Green.ToNative() }; view.Add(menu); var scrollView = new ScrollView() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; int itemWidth = 300; int itemHeight = 300; int itemCols = 10; int itemRows = 10; var outterLayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical, }, SizeWidth = itemWidth * itemCols, SizeHeight = itemHeight * itemRows }; scrollView.Add(outterLayout); for (int i = 0; i < itemRows; i++) { var innerLayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, SizeHeight = itemHeight, SizeWidth = itemWidth * itemCols, }; for (int j = 0; j < itemCols; j++) { var rnd = new Random(); var item = new View { SizeWidth = itemWidth, SizeHeight = itemHeight, BackgroundColor = Color.FromRgb(rnd.Next(10, 255), rnd.Next(10, 255), rnd.Next(10, 255)).ToNative() }; innerLayout.Add(item); } outterLayout.Add(innerLayout); } scrollView.ScrollingEventThreshold = 1; scrollView.ScrollDragStarted += (s, e) => Console.WriteLine($"DragStarted"); scrollView.ScrollDragEnded += (s, e) => Console.WriteLine("DragEnd"); scrollView.ScrollAnimationStarted += (s, e) => Console.WriteLine($"ScrollAnimation started"); scrollView.ScrollAnimationEnded += (s, e) => Console.WriteLine("$ScrollAnimation ended"); scrollView.Scrolling += (s, e) => { Console.WriteLine($"OnScrolling : Bound : {scrollView.ScrollBound} - {e.Position.X}x{e.Position.Y}"); }; var direction = new Button() { Text = "direction(V)", SizeHeight = 300, SizeWidth = 300, }; direction.Clicked += (s, e) => { if (scrollView.ScrollOrientation == ScrollOrientation.Horizontal) { scrollView.ScrollOrientation = ScrollOrientation.Vertical; direction.Text = "direction(V)"; } else { scrollView.ScrollOrientation = ScrollOrientation.Horizontal; direction.Text = "direction(H)"; } }; menu.Add(direction); var scrollBar = new Button() { Text = "Bar(Never)", SizeHeight = 300, SizeWidth = 300, }; scrollBar.Clicked += (s, e) => { if (scrollView.VerticalScrollBarVisibility == ScrollBarVisibility.Never) { scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Default; scrollBar.Text = "Bar(Default)"; } else if (scrollView.VerticalScrollBarVisibility == ScrollBarVisibility.Default) { scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Always; scrollBar.Text = "Bar(Always)"; } else if (scrollView.VerticalScrollBarVisibility == ScrollBarVisibility.Always) { scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Never; scrollBar.Text = "Bar(Never)"; } }; menu.Add(scrollBar); view.Add(scrollView); return(view); }
public override View Run() { var view = new View { Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, } }; var menu = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal }, SizeHeight = 200, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Green.ToNative() }; view.Add(menu); var scrollView = new ScrollView() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; int itemWidth = 300; int itemHeight = 300; int itemCols = 10; int itemRows = 10; var outterLayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical, }, SizeWidth = itemWidth * itemCols, SizeHeight = itemHeight * itemRows }; scrollView.Add(outterLayout); for (int i = 0; i < itemRows; i++) { var innerLayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, SizeHeight = itemHeight, SizeWidth = itemWidth * itemCols, }; for (int j = 0; j < itemCols; j++) { var rnd = new Random(); var item = new View { SizeWidth = itemWidth, SizeHeight = itemHeight, BackgroundColor = Color.FromRgb(rnd.Next(10, 255), rnd.Next(10, 255), rnd.Next(10, 255)).ToNative() }; innerLayout.Add(item); } outterLayout.Add(innerLayout); } scrollView.Scrolling += (s, e) => { Console.WriteLine($"OnScrolling : Bound : {scrollView.ScrollBound}"); }; var direction = new Button() { Text = "direction(V)", SizeHeight = 300, SizeWidth = 300, }; direction.Clicked += (s, e) => { if (scrollView.ScrollOrientation == ScrollOrientation.Horizontal) { scrollView.ScrollOrientation = ScrollOrientation.Vertical; direction.Text = "direction(V)"; } else { scrollView.ScrollOrientation = ScrollOrientation.Horizontal; direction.Text = "direction(H)"; } }; menu.Add(direction); var scrollBar = new Button() { Text = "Bar(X)", SizeHeight = 300, SizeWidth = 300, }; scrollBar.Clicked += (s, e) => { if (scrollView.HideScrollbar) { scrollView.HideScrollbar = false; scrollBar.Text = "Bar(O)"; } else { scrollView.HideScrollbar = true; scrollBar.Text = "Bar(X)"; } }; menu.Add(scrollBar); view.Add(scrollView); return(view); }
public override View Run() { var main = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; main.Add(new Label { Text = "Refresh Layout Test", TextColor = Color.White, FontSize = 9, FontAttributes = Tizen.UIExtensions.Common.FontAttributes.Bold, VerticalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Center, WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 100, Padding = new Extents(20, 10, 10, 10), BackgroundColor = Color.FromHex("#2196f3").ToNative(), BoxShadow = new Shadow(5, Color.FromHex("#bbbbbb").ToNative(), new Vector2(0, 5)) }); var scrollview = new Tizen.UIExtensions.NUI.ScrollView() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; scrollview.ContentContainer.Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical, }; for (int i = 0; i < 3; i++) { var rnd = new Random(); var child = new View { WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 50, }; child.BackgroundColor = new Tizen.NUI.Color(rnd.NextSingle(), rnd.NextSingle(), rnd.NextSingle(), 1); scrollview.Add(child); } var startRefresh = new Tizen.UIExtensions.NUI.Button() { Text = "StartRefresh" }; scrollview.Add(startRefresh); var changeBg = new Tizen.UIExtensions.NUI.Button() { Text = "Change background" }; scrollview.Add(changeBg); var changeColor = new Tizen.UIExtensions.NUI.Button() { Text = "Change Color" }; scrollview.Add(changeColor); for (int i = 0; i < 100; i++) { var rnd = new Random(); var child = new View { WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 50, }; child.BackgroundColor = new Tizen.NUI.Color(rnd.NextSingle(), rnd.NextSingle(), rnd.NextSingle(), 1); scrollview.Add(child); } var wrapperView = new View { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; wrapperView.Add(scrollview); var refreshView = new RefreshLayout() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, Content = wrapperView, }; refreshView.Refreshing += async(s, e) => { await System.Threading.Tasks.Task.Delay(2000); refreshView.IsRefreshing = false; }; main.Add(refreshView); startRefresh.Clicked += (s, e) => refreshView.IsRefreshing = true; changeBg.Clicked += (s, e) => { if (refreshView.IconBackgroundColor == Color.Default) { refreshView.IconBackgroundColor = Color.Green; } else { refreshView.IconBackgroundColor = Color.Default; } }; changeColor.Clicked += (s, e) => { if (refreshView.IconColor == Color.Default) { refreshView.IconColor = Color.Red; } else { refreshView.IconColor = Color.Default; } }; return(main); }
public override View Run() { var scrollView = new ScrollView(); scrollView.UpdateBackgroundColor(Color.FromHex("#618833")); scrollView.ContentContainer.Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical }; List <CustomRenderingView> viewList = new List <CustomRenderingView>(); for (int i = 0; i < 5; i++) { var canvas = new SKCanvasView() { Margin = new Extents(5, 5, 5, 5), SizeWidth = 300, SizeHeight = 300, }; var hlayout = new View { SizeHeight = 310, Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.Center, } }; canvas.PaintSurface += Draw; hlayout.Add(canvas); viewList.Add(canvas); scrollView.Add(hlayout); } timer = new Timer(10); timer.Tick += (s, e) => { startx += 10; starty += 1; if (startx + 100 >= 300) { startx = 0; } if (starty + 100 >= 300) { starty = 0; } foreach (var view in viewList) { view.Invalidate(); } return(true); }; scrollView.RemovedFromWindow += (s, e) => { timer.Stop(); }; timer.Start(); return(scrollView); }