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 scrollview = new Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.Add(new Label { Text = "Graphics View", 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)) }); view.Add(new View { SizeHeight = 20, }); view.Add(new Label { Padding = new Extents(10, 0, 0, 0), Text = "ActivityIndicator", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); var hlayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, Padding = 10, }; { var ai = new ActivityIndicator { IsRunning = true, Margin = 5, }; ai.SizeHeight = (float)ai.Measure(300, 300).Height; ai.SizeWidth = (float)ai.Measure(300, 300).Width; view.Add(ai); hlayout.Add(ai); var timer = ElmSharp.EcoreMainloop.AddTimer(3, () => { ai.IsRunning = !ai.IsRunning; return(true); }); ai.RemovedFromWindow += (s, e) => { ElmSharp.EcoreMainloop.RemoveTimer(timer); (s as View).Dispose(); }; } { var ai = new ActivityIndicator { Color = Color.FromHex("#ff9800"), IsRunning = true, Margin = 5 }; ai.SizeHeight = (float)ai.Measure(300, 300).Height; ai.SizeWidth = (float)ai.Measure(300, 300).Width; view.Add(ai); hlayout.Add(ai); var timer = ElmSharp.EcoreMainloop.AddTimer(3.3, () => { ai.IsRunning = !ai.IsRunning; return(true); }); ai.RemovedFromWindow += (s, e) => { ElmSharp.EcoreMainloop.RemoveTimer(timer); (s as View).Dispose(); }; } { var ai = new ActivityIndicator { Color = Color.FromHex("#ffeb3b"), IsRunning = true, Margin = 5 }; ai.SizeHeight = (float)ai.Measure(300, 300).Height; ai.SizeWidth = (float)ai.Measure(300, 300).Width; view.Add(ai); hlayout.Add(ai); var timer = ElmSharp.EcoreMainloop.AddTimer(4, () => { ai.IsRunning = !ai.IsRunning; return(true); }); ai.RemovedFromWindow += (s, e) => { ElmSharp.EcoreMainloop.RemoveTimer(timer); (s as View).Dispose(); }; } view.Add(hlayout); view.Add(new Label { Padding = new Extents(10, 0, 0, 0), Text = "ProgressBar", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var progressBar2 = new ProgressBar { Margin = 10, WidthSpecification = LayoutParamPolicies.MatchParent, ProgressColor = Color.GreenYellow, }; progressBar2.SizeHeight = (float)progressBar2.Measure(300, 300).Height; view.Add(progressBar2); var timer = ElmSharp.EcoreMainloop.AddTimer(1, () => { if (progressBar2.Progress >= 1.0) { progressBar2.Progress = 0; } progressBar2.ProgressTo(progressBar2.Progress + 0.2); return(true); }); progressBar2.RemovedFromWindow += (s, e) => ElmSharp.EcoreMainloop.RemoveTimer(timer); } var progressBar1 = new ProgressBar { Margin = 10, WidthSpecification = LayoutParamPolicies.MatchParent, }; progressBar1.SizeHeight = (float)progressBar1.Measure(300, 300).Height; view.Add(progressBar1); view.Add(new View { SizeHeight = 10, WidthSpecification = LayoutParamPolicies.MatchParent, }); view.Add(new Label { Padding = new Extents(10, 0, 10, 0), Text = "Slider", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var slider1 = new Slider { IsEnabled = false, Margin = 5, Value = 0, Minimum = 0, Maximum = 1, SizeHeight = 50, WidthSpecification = LayoutParamPolicies.MatchParent, }; slider1.ValueChanged += (s, e) => { progressBar1.Progress = slider1.Value; }; view.Add(slider1); } { var slider1 = new Slider { Margin = 5, Value = 0, Minimum = 0, Maximum = 1, SizeHeight = 50, MaximumTrackColor = Color.Red, MinimumTrackColor = Color.Green, ThumbColor = Color.Yellow, WidthSpecification = LayoutParamPolicies.MatchParent, }; view.Add(slider1); } { var slider1 = new Slider { Margin = 5, Value = 0, Minimum = -20, Maximum = 10, SizeHeight = 50, MaximumTrackColor = Color.Red, MinimumTrackColor = Color.Green, ThumbColor = Color.Yellow, WidthSpecification = LayoutParamPolicies.MatchParent, }; view.Add(slider1); } view.Add(new Label { Padding = new Extents(10, 0, 10, 0), Text = "Button", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var button = new Tizen.UIExtensions.NUI.GraphicsView.Button { IsEnabled = false, Margin = 5, Text = "Clicked 0", CornerRadius = 10, }; button.SizeHeight = (float)button.Measure(300, 300).Height; button.SizeWidth = (float)button.Measure(300, 300).Width; int count = 1; button.Clicked += (s, e) => { button.Text = $"Clicked {count++}"; }; view.Add(button); } { var button = new Tizen.UIExtensions.NUI.GraphicsView.Button { Margin = 5, BackgroundColor = Color.Green, Text = "BUTTON", }; button.SizeHeight = (float)button.Measure(300, 300).Height; button.SizeWidth = (float)button.Measure(300, 300).Width; view.Add(button); } { var button = new Tizen.UIExtensions.NUI.GraphicsView.Button { Margin = 5, BackgroundColor = Color.Red, Text = "BUTTON", }; button.SizeHeight = (float)button.Measure(300, 300).Height; button.SizeWidth = (float)button.Measure(300, 300).Width + 100; view.Add(button); } view.Add(new Label { Padding = new Extents(10, 0, 10, 0), Text = "CheckBox", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var checkbox1 = new CheckBox { Margin = 5, Text = "CheckBox1", }; checkbox1.SizeHeight = (float)checkbox1.Measure(300, 300).Height; checkbox1.SizeWidth = (float)checkbox1.Measure(300, 300).Width; view.Add(checkbox1); } { var checkbox1 = new CheckBox { IsEnabled = false, Margin = 5, Text = "CheckBox1", }; checkbox1.SizeHeight = (float)checkbox1.Measure(300, 300).Height; checkbox1.SizeWidth = (float)checkbox1.Measure(300, 300).Width; view.Add(checkbox1); } { var checkbox1 = new CheckBox { IsEnabled = false, IsChecked = true, Margin = 5, Text = "CheckBox1", }; checkbox1.SizeHeight = (float)checkbox1.Measure(300, 300).Height; checkbox1.SizeWidth = (float)checkbox1.Measure(300, 300).Width; view.Add(checkbox1); } { var checkbox1 = new CheckBox { Margin = 5, Color = Color.Red, Text = "Red", }; checkbox1.SizeHeight = (float)checkbox1.Measure(300, 300).Height; checkbox1.SizeWidth = (float)checkbox1.Measure(300, 300).Width; view.Add(checkbox1); } { var checkbox1 = new CheckBox { Margin = 5, Color = Color.Blue, Text = "Blue", }; checkbox1.SizeHeight = (float)checkbox1.Measure(300, 300).Height; checkbox1.SizeWidth = (float)checkbox1.Measure(300, 300).Width; view.Add(checkbox1); } view.Add(new Label { Padding = new Extents(10, 0, 10, 0), Text = "Switch", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); hlayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, Padding = 10, }; { var switch1 = new Switch { Margin = 5, }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } { var switch1 = new Switch { IsEnabled = false, Margin = 5, ThumbColor = Color.Red, OnColor = Color.Yellow }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } { var switch1 = new Switch { Margin = 5, ThumbColor = Color.BlueViolet, OnColor = Color.Red, IsToggled = true, }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } view.Add(hlayout); view.Add(new Label { Padding = new Extents(10, 0, 10, 0), Text = "Stepper", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); var stepper = new Stepper(); stepper.SizeHeight = (float)stepper.Measure(300, 300).Height; stepper.SizeWidth = (float)stepper.Measure(300, 300).Width; view.Add(stepper); var stepperLabel = new Label { Text = "0", }; view.Add(stepperLabel); stepper.ValueChanged += (s, e) => stepperLabel.Text = $"{stepper.Value}"; view.Add(new Label { Padding = 10, Text = "Entry", FontSize = 7, HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); var gEntry = new Tizen.UIExtensions.NUI.GraphicsView.Entry { Placeholder = "Entry", }; gEntry.SizeHeight = (float)gEntry.Measure(600, 300).Height; gEntry.SizeWidth = (float)gEntry.Measure(600, 300).Width; view.Add(gEntry); view.Add(new View { SizeHeight = 20 }); var gEntry2 = new Tizen.UIExtensions.NUI.GraphicsView.Entry { Placeholder = "Entry2", PlaceholderColor = Color.Red, }; gEntry2.SizeHeight = (float)gEntry2.Measure(600, 300).Height; gEntry2.SizeWidth = (float)gEntry2.Measure(600, 300).Width; view.Add(gEntry2); view.Add(new View { SizeHeight = 60 }); var editor = new Tizen.UIExtensions.NUI.GraphicsView.Editor { Placeholder = "Editor" }; editor.SizeHeight = 500; editor.SizeWidth = (float)editor.Measure(600, 300).Width; view.Add(editor); view.Add(new View { SizeHeight = 600 }); return(scrollview); }
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 Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.Add(new Label { Text = "RefreshIcon 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)) }); view.Add(new View { SizeHeight = 20, }); var hlayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, //BackgroundColor = Tizen.NUI.Color.Gray, Padding = 10, }; var refreshIcon = new RefreshIcon { BorderlineColor = Tizen.NUI.Color.Red, BorderlineWidth = 2f, }; refreshIcon.SizeHeight = (float)refreshIcon.Measure(300, 300).Height; refreshIcon.SizeWidth = (float)refreshIcon.Measure(300, 300).Width; hlayout.Add(refreshIcon); var refreshIcon2 = new RefreshIcon { Color = Color.Red, BackgroundColor = Color.Yellow, }; refreshIcon2.SizeHeight = (float)refreshIcon2.Measure(300, 300).Height; refreshIcon2.SizeWidth = (float)refreshIcon2.Measure(300, 300).Width; hlayout.Add(refreshIcon2); view.Add(hlayout); var slider1 = new Slider { Value = 0, Minimum = 0, Maximum = 1, SizeHeight = 50, WidthSpecification = LayoutParamPolicies.MatchParent, }; view.Add(slider1); slider1.ValueChanged += (s, e) => { refreshIcon.PullDistance = (float)slider1.Value; refreshIcon2.PullDistance = (float)slider1.Value; }; var switch1 = new Switch() { SizeHeight = 50, WidthSpecification = LayoutParamPolicies.MatchParent, }; view.Add(switch1); switch1.Toggled += (s, e) => { refreshIcon.IsRunning = switch1.IsToggled; refreshIcon2.IsRunning = switch1.IsToggled; }; return(scrollview); }
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); }
public override View Run() { var view = new View { Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, } }; var scrollView = new ScrollView() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; view.Add(scrollView); scrollView.ContentContainer.Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical, }; { var img = new Image { WidthResizePolicy = ResizePolicyType.FillToParent, SizeHeight = 300, BackgroundColor = Color.Red, ResourceUrl = Application.Current.DirectoryInfo.Resource + "image.png", }; scrollView.ContentContainer.Add(img); } { var img = new Image { SizeHeight = 300, WidthSpecification = LayoutParamPolicies.MatchParent, ResourceUrl = "http://i.imgur.com/9f974SC.jpg", // now it does not working, but NUI team will fix it Aspect = Tizen.UIExtensions.Common.Aspect.AspectFill }; img.ResourceReady += (s, e) => { Console.WriteLine($"Image Loaded - {img.LoadingStatus}"); }; scrollView.ContentContainer.Add(new Label { Text = "AspectFill" }); scrollView.ContentContainer.Add(img); } { var img = new Image { SizeHeight = 300, WidthSpecification = LayoutParamPolicies.MatchParent, ResourceUrl = "http://i.imgur.com/9f974SC.jpg", // now it does not working, but NUI team will fix it Aspect = Tizen.UIExtensions.Common.Aspect.AspectFit }; img.ResourcesLoaded += (s, e) => { Console.WriteLine($"Image Loaded - {img.LoadingStatus}"); }; scrollView.ContentContainer.Add(new Label { Text = "AspectFit" }); scrollView.ContentContainer.Add(img); } { var img = new Image { SizeHeight = 300, WidthSpecification = LayoutParamPolicies.MatchParent, ResourceUrl = "http://i.imgur.com/9f974SC.jpg", // now it does not working, but NUI team will fix it Aspect = Tizen.UIExtensions.Common.Aspect.Fill }; img.ResourcesLoaded += (s, e) => { Console.WriteLine($"Image Loaded - {img.LoadingStatus}"); }; scrollView.ContentContainer.Add(new Label { Text = "Fill" }); scrollView.ContentContainer.Add(img); } { var img = new Image { ResourceUrl = Application.Current.DirectoryInfo.Resource + "animated2.gif", }; img.SetIsAnimationPlaying(true); img.ResourcesLoaded += (s, e) => { // Aspect not apply before loaded image Console.WriteLine($"Image Loaded"); }; scrollView.ContentContainer.Add(new Label { Text = "Animated" }); scrollView.ContentContainer.Add(img); } { var img = new Image { ResourceUrl = Application.Current.DirectoryInfo.Resource + "animated2.gif", }; img.SetIsAnimationPlaying(false); img.ResourcesLoaded += (s, e) => { // Aspect not apply before loaded image Console.WriteLine($"Image Loaded"); }; scrollView.ContentContainer.Add(new Label { Text = "SetIsAnimationPlaying(false)" }); scrollView.ContentContainer.Add(img); } return(view); }
public override View Run() { var scrollview = new Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.Add(new Label { Text = "MaterialIconButton", TextColor = Color.White, FontSize = 9, FontAttributes = FontAttributes.Bold, VerticalTextAlignment = 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)) }); view.Add(new View { SizeHeight = 20, }); foreach (var icon in Enum.GetValues(typeof(MaterialIcons))) { view.Add(new Label { Padding = new Extents(10, 0, 0, 0), Text = icon.ToString(), FontSize = 7, HorizontalTextAlignment = TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var button = new MaterialIconButton() { Icon = (MaterialIcons)icon, }; button.SizeHeight = (float)button.Measure(300, 300).Height; button.SizeWidth = (float)button.Measure(300, 300).Width; view.Add(button); } } foreach (var icon in Enum.GetValues(typeof(MaterialIcons)).Cast <MaterialIcons>().Take(3)) { view.Add(new Label { Padding = new Extents(10, 0, 0, 0), Text = icon.ToString(), FontSize = 7, HorizontalTextAlignment = TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var button = new MaterialIconButton() { Icon = icon, }; button.SizeHeight = 100; button.SizeWidth = 100; button.UpdateBackgroundColor(Color.Yellow); view.Add(button); } } foreach (var icon in Enum.GetValues(typeof(MaterialIcons)).Cast <MaterialIcons>().Take(3)) { view.Add(new Label { Padding = new Extents(10, 0, 0, 0), Text = icon.ToString(), FontSize = 7, HorizontalTextAlignment = TextAlignment.Start, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }); { var button = new MaterialIconButton() { Icon = icon, }; button.SizeHeight = (float)DeviceInfo.ScalingFactor * 10; button.SizeWidth = (float)DeviceInfo.ScalingFactor * 10; button.UpdateBackgroundColor(Color.Yellow); view.Add(button); } } return(scrollview); }
public override View Run() { var scrollView = new Tizen.UIExtensions.NUI.ScrollView { BackgroundColor = Color.Blue, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent }; scrollView.ContentContainer.Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; scrollView.ContentContainer.WidthSpecification = LayoutParamPolicies.MatchParent; scrollView.ContentContainer.HeightSpecification = LayoutParamPolicies.WrapContent; { var clipper = new SKClipperView { WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 300, }; clipper.DrawClippingArea += OnDrawCircle; clipper.Add(new Image { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, ResourceUrl = Application.Current.DirectoryInfo.Resource + "dotnet_bot.png", }); scrollView.ContentContainer.Add(clipper); var btn = new Button { Text = "Change" }; scrollView.ContentContainer.Add(btn); btn.Clicked += (s, e) => { if (isCircle) { clipper.DrawClippingArea -= OnDrawCircle; clipper.DrawClippingArea += OnDrawRoundRect; } else { clipper.DrawClippingArea -= OnDrawRoundRect; clipper.DrawClippingArea += OnDrawCircle; } isCircle = !isCircle; clipper.Invalidate(); }; } for (int i = 0; i < 10; i++) { var clipper = new SKClipperView { WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 300, }; clipper.DrawClippingArea += (s, e) => { var canvas = e.Surface.Canvas; var width = e.Info.Width; var height = e.Info.Height; using (var paint = new SKPaint { IsAntialias = true, Color = SKColors.White, Style = SKPaintStyle.Fill, }) { canvas.Clear(); canvas.DrawCircle(width / 2.0f, height / 2.0f, Math.Min(width, height) / 2.0f, paint); } }; clipper.Add(new Image { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, ResourceUrl = Application.Current.DirectoryInfo.Resource + "dotnet_bot.png", }); clipper.Add(new Label { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, Text = "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text", LineBreakMode = LineBreakMode.CharacterWrap, }); scrollView.ContentContainer.Add(clipper); } return(scrollView); }
public override View Run() { var scrollview = new Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.Add(new Label { Text = "Switch 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)) }); view.Add(new View { SizeHeight = 20, }); var hlayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, Padding = 10, }; Switch switchtest = null; { var switch1 = new Switch { Margin = 5, }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } { var switch1 = new Switch { IsEnabled = false, Margin = 5, ThumbColor = Color.Red, OnColor = Color.Yellow }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } { var switch1 = new Switch { Margin = 5, ThumbColor = Color.BlueViolet, OnColor = Color.Red, IsToggled = true, }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); switchtest = switch1; } view.Add(hlayout); var btn = new Tizen.UIExtensions.NUI.Button { Text = "Toggle" }; btn.Clicked += (s, e) => switchtest.IsToggled = !switchtest.IsToggled; scrollview.ContentContainer.Add(btn); return(scrollview); }
public override View Run() { var scrollview = new Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.UpdateBackgroundColor(TColor.FromHex("#eeeeee")); view.Add(new TitleView { Title = "Title view 1", Icon = new MaterialIconButton { Icon = MaterialIcons.ArrowBack, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), Color = TColor.White }, Actions = { new MaterialIconButton { Icon = MaterialIcons.MoreVert, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), Color = TColor.White }, } }); view.Add(new View { SizeHeight = 20, }); var title2 = new TitleView { Title = "Title view 2" }; title2.UpdateBackgroundColor(TColor.White); title2.Label.TextColor = TColor.Black; title2.Icon = new MaterialIconButton { Icon = MaterialIcons.Menu, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), }; title2.Actions.Add(new MaterialIconButton { Icon = MaterialIcons.Close, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), }); view.Add(title2); view.Add(new View { SizeHeight = 20, }); var title3 = new TitleView(); title3.UpdateBackgroundColor(TColor.FromHex("6200EE")); title3.Icon = new MaterialIconButton { Icon = MaterialIcons.ArrowBack, Color = TColor.White, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), }; title3.Content = new Tizen.UIExtensions.NUI.Entry { PlaceholderText = "Search", PlaceholderColor = TColor.FromHex("#222222"), VerticalTextAlignment = TextAlignment.Center, HeightSpecification = LayoutParamPolicies.MatchParent, WidthSpecification = LayoutParamPolicies.MatchParent, Margin = new Extents(0, 10, 5, 5), }; title3.Content.UpdateBackgroundColor(TColor.FromHex("#eeeeee")); title3.Icon = new MaterialIconButton { Icon = MaterialIcons.Check, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), Color = TColor.White, }; view.Add(title3); view.Add(new View { SizeHeight = 20, }); var title4 = new TitleView(); title4.UpdateBackgroundColor(TColor.FromHex("6200EE")); title4.Icon = new MaterialIconButton { Icon = MaterialIcons.ArrowBack, Color = TColor.White, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), }; title4.Content = new Tizen.UIExtensions.NUI.Entry { PlaceholderText = "Search", PlaceholderColor = TColor.FromHex("#222222"), VerticalTextAlignment = TextAlignment.Center, HeightSpecification = LayoutParamPolicies.MatchParent, WidthSpecification = LayoutParamPolicies.MatchParent, Margin = new Extents(0, 10, 5, 5), }; title4.Content.UpdateBackgroundColor(TColor.FromHex("#eeeeee")); title4.Icon = new MaterialIconButton { Icon = MaterialIcons.Menu, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), Color = TColor.White, }; title4.Actions.Add(new MaterialIconButton { Icon = MaterialIcons.Check, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), Color = TColor.White, }); title4.Actions.Add(new MaterialIconButton { Icon = MaterialIcons.Close, SizeWidth = (float)(25 * DeviceInfo.ScalingFactor), SizeHeight = (float)(25 * DeviceInfo.ScalingFactor), Color = TColor.White, }); view.Add(title4); return(scrollview); }