浏览代码

Updated scenario

Tig 1 年之前
父节点
当前提交
25a2e040f0
共有 1 个文件被更改,包括 24 次插入1 次删除
  1. 24 1
      UICatalog/Scenarios/VirtualContentScrolling.cs

+ 24 - 1
UICatalog/Scenarios/VirtualContentScrolling.cs

@@ -241,7 +241,30 @@ public class VirtualScrolling : Scenario
             view.ContentSize = view.ContentSize with { Height = ((Buttons.NumericUpDown)sender).Value };
             view.ContentSize = view.ContentSize with { Height = ((Buttons.NumericUpDown)sender).Value };
         }
         }
 
 
-        view.Padding.Add (labelContentSize, contentSizeWidth, labelComma, contentSizeHeight);
+
+        var cbClearOnlyVisible = new CheckBox ()
+        {
+            Title = "Clear only Visible Content",
+            X = Pos.Right (contentSizeHeight) + 1,
+            Y = Pos.Top (labelContentSize),
+            CanFocus = false
+        };
+        cbClearOnlyVisible.Checked = view.ViewportSettings.HasFlag (ViewportSettings.ClearVisibleContentOnly);
+        cbClearOnlyVisible.Toggled += ClearVisibleContentOnly_Toggled;
+
+        void ClearVisibleContentOnly_Toggled (object sender, StateEventArgs<bool?> e)
+        {
+            if (e.NewValue == true)
+            {
+                view.ViewportSettings |= ViewportSettings.ClearVisibleContentOnly;
+            }
+            else
+            {
+                view.ViewportSettings &= ~ViewportSettings.ClearVisibleContentOnly;
+            }
+        }
+
+        view.Padding.Add (labelContentSize, contentSizeWidth, labelComma, contentSizeHeight, cbClearOnlyVisible);
 
 
 
 
         // Add demo views to show that things work correctly
         // Add demo views to show that things work correctly