diff --git a/NUITizenGallery/Examples/ScrollViewTest8/ScrollViewTest8.cs b/NUITizenGallery/Examples/ScrollViewTest8/ScrollViewTest8.cs new file mode 100644 index 0000000..e5cf444 --- /dev/null +++ b/NUITizenGallery/Examples/ScrollViewTest8/ScrollViewTest8.cs @@ -0,0 +1,40 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using Tizen.NUI; +using Tizen.NUI.Components; + +namespace NUITizenGallery +{ + internal class ScrollViewTest8 : IExample + { + private Window window; + private ScrollViewTest8Page page; + public void Activate() + { + window = NUIApplication.GetDefaultWindow(); + page = new ScrollViewTest8Page(); + window.GetDefaultNavigator().Push(page); + } + public void Deactivate() + { + window.GetDefaultNavigator().Pop(); + page = null; ; + } + } +} diff --git a/NUITizenGallery/Examples/ScrollViewTest8/ScrollViewTest8.xaml.cs b/NUITizenGallery/Examples/ScrollViewTest8/ScrollViewTest8.xaml.cs new file mode 100644 index 0000000..7681f83 --- /dev/null +++ b/NUITizenGallery/Examples/ScrollViewTest8/ScrollViewTest8.xaml.cs @@ -0,0 +1,97 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using Tizen.NUI; +using Tizen.NUI.BaseComponents; +using Tizen.NUI.Components; + +namespace NUITizenGallery +{ + public partial class ScrollViewTest8Page : ContentPage + { + public ScrollViewTest8Page() + { + InitializeComponent(); + + for (int i = 0; i <= 200; ++i) + { + var t = new TextLabel + { + Text = String.Format("I am label #{0}", i), + HeightSpecification = 70, + WidthSpecification = LayoutParamPolicies.MatchParent, + }; + Scroller.Add(t); + } + + btn1.Clicked += (o, e) => + { + //ScrollStep +100 + }; + + btn2.Clicked += (o, e) => + { + //ScrollStep -100 + }; + } + protected override void Dispose(DisposeTypes type) + { + if (Disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + RemoveAllChildren(true); + } + + base.Dispose(type); + } + + private void RemoveAllChildren(bool dispose = false) + { + RecursiveRemoveChildren(this, dispose); + } + + private void RecursiveRemoveChildren(View parent, bool dispose) + { + if (parent == null) + { + return; + } + + int maxChild = (int)parent.ChildCount; + for (int i = maxChild - 1; i >= 0; --i) + { + View child = parent.GetChildAt((uint)i); + if (child == null) + { + continue; + } + + RecursiveRemoveChildren(child, dispose); + parent.Remove(child); + if (dispose) + { + child.Dispose(); + } + } + } + } +} + diff --git a/NUITizenGallery/NUITizenGallery.csproj b/NUITizenGallery/NUITizenGallery.csproj index 03fb5c0..55e310d 100755 --- a/NUITizenGallery/NUITizenGallery.csproj +++ b/NUITizenGallery/NUITizenGallery.csproj @@ -366,6 +366,9 @@ MSBuild:Compile + + MSBuild:Compile + MSBuild:Compile @@ -436,7 +439,7 @@ MSBuild:Compile - MSBuild:Compile + MSBuild:Compile MSBuild:Compile diff --git a/NUITizenGallery/res/layout/ScrollViewTest8Page.xaml b/NUITizenGallery/res/layout/ScrollViewTest8Page.xaml new file mode 100644 index 0000000..9e9b9fc --- /dev/null +++ b/NUITizenGallery/res/layout/ScrollViewTest8Page.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + +