Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         var root = new FolderBrowserDialog()
         {
             SelectedPath = "."
         };
         var exit = new EnumSelector <Confirm> {
             Header = "Do you want to quit?"
         };
         var extensions = FlagSelector.New <Extensions>();
         var exts       = Enum.GetValues(typeof(Extensions)).Cast <Extensions>();
         extensions.AllowCancel = false;
         Selector <object> menu;
         do
         {
             extensions.Activate();
             root.ShowDialog();
             menu = CreateMenu(root.SelectedPath, exit, exts.Where(x => extensions.Value.HasFlag(x)).Select(x => $".{x}"));
             if (menu == null)
             {
                 DisplayErrorMessage("Cannot select folder. It contains no textfiles.", "[Press enter to load another folder]");
                 continue;
             }
             menu.Activate();
         } while (exit.Value != Confirm.Yes);
     }
     catch (Exception ex)
     {
         DisplayErrorMessage($"An error has occured:\n{ex.Message}", "[Press enter to exit]");
     }
 }
        public VariableSizeTemplateGridGallery(ItemsLayoutOrientation orientation = ItemsLayoutOrientation.Vertical)
        {
            var layout = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    }
                }
            };

            var itemsLayout = new GridItemsLayout(2, orientation);

            var itemTemplate = ExampleTemplates.VariableSizeTemplate();

            var collectionView = new CollectionView
            {
                ItemsLayout        = itemsLayout,
                ItemTemplate       = itemTemplate,
                ItemSizingStrategy = ItemSizingStrategy.MeasureFirstItem
            };

            var generator = new ItemsSourceGenerator(collectionView, 100);

            var explanation = new Label();

            UpdateExplanation(explanation, collectionView.ItemSizingStrategy);

            var sizingStrategySelector = new EnumSelector <ItemSizingStrategy>(() => collectionView.ItemSizingStrategy,
                                                                               mode =>
            {
                collectionView.ItemSizingStrategy = mode;
                UpdateExplanation(explanation, collectionView.ItemSizingStrategy);
            });

            layout.Children.Add(generator);

            layout.Children.Add(sizingStrategySelector);
            Grid.SetRow(sizingStrategySelector, 1);

            layout.Children.Add(explanation);
            Grid.SetRow(explanation, 2);

            layout.Children.Add(collectionView);
            Grid.SetRow(collectionView, 3);

            Content = layout;

            generator.GenerateItems();
        }
Ejemplo n.º 3
0
        private void DrawFirstToolbar()
        {
            //选项
            GUILayout.Space(1);
            Rect rect = GUILayoutUtility.GetRect(0f, ToolbarHeight, SirenixGUIStyles.ToolbarBackground);

            rect = rect.SetHeight(ToolbarHeight);
            var  opptionWidth = SirenixGUIStyles.LeftAlignedCenteredLabel.CalcSize(this.m_optionGui).x * 2f;
            Rect leftRect     = rect.AlignLeft(opptionWidth);

            OdinSelector <int> .DrawSelectorDropdown(leftRect, this.m_optionGui, this.SelectType, btnStyle);

            //搜索
            Rect filterRect = rect.AlignRight(opptionWidth * 2);
            Rect searchRect = rect.SetXMax(filterRect.xMin).SetXMin(opptionWidth);

            searchRect            = searchRect.HorizontalPadding(5f).AlignMiddle(16);
            this.m_sSearchKeyName = SirenixEditorGUI.SearchField(searchRect, this.m_sSearchKeyName);
            //数据类型过滤
            EditorGUI.BeginChangeCheck();
            this.m_eDataFilterType = EnumSelector <EPlayerPrefsType> .DrawEnumField(filterRect, null, new GUIContent("Type Filter"), this.m_eDataFilterType, CaomaoPlayerPrefsWindow.btnStyle);

            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetInt("CaomaoPlayerPrefsWindow.m_eDataFilterType", (int)this.m_eDataFilterType);
            }
        }
Ejemplo n.º 4
0
        public void DrawOverview()
        {
            if (Event.current.type == EventType.Layout && this.nextDisplay != null)
            {
                this.Display     = this.nextDisplay.Value;
                this.nextDisplay = null;
                this.Update();
            }

            if (Event.current.type == EventType.Layout && this.shouldSort)
            {
                this.shouldSort = false;
                this.Sort();
            }

            EnumBtnStyle = EnumBtnStyle ?? new GUIStyle(EditorStyles.toolbarDropDown);
            EnumBtnStyle.stretchHeight = true;
            EnumBtnStyle.fixedHeight   = this.Tree.Config.SearchToolbarHeight;

            GUILayout.BeginHorizontal(GUILayoutOptions.ExpandHeight());
            {
                var rect       = GUIHelper.GetCurrentLayoutRect();
                var columnRect = rect.AddYMin(this.Tree.Config.SearchToolbarHeight);

                GUILayout.BeginVertical(GUILayoutOptions.Width(rect.width).ExpandHeight());
                {
                    EditorGUI.DrawRect(columnRect.AddYMin(this.Tree.Config.DefaultMenuStyle.Height), SirenixGUIStyles.EditorWindowBackgroundColor);

                    GUILayout.BeginHorizontal();
                    this.Tree.DrawSearchToolbar();
                    var displayRect = GUILayoutUtility.GetRect(95, this.Tree.Config.SearchToolbarHeight, GUILayoutOptions.Width(95));
                    displayRect.height = this.Tree.Config.SearchToolbarHeight;
                    displayRect.width -= 1;

                    var newDisplay = EnumSelector <DisplayOptions> .DrawEnumField(displayRect, null, GUIHelper.TempContent("Data Columns"), this.Display, EnumBtnStyle);

                    if (newDisplay != this.Display)
                    {
                        this.nextDisplay = newDisplay;
                    }

                    GUILayout.EndHorizontal();

                    GUITableUtilities.ResizeColumns(columnRect, this.columns);
                    this.DrawColumnHeaders();
                    this.Tree.DrawMenuTree();
                }

                GUILayout.EndVertical();
                GUITableUtilities.DrawColumnHeaderSeperators(columnRect, this.columns, SirenixGUIStyles.BorderColor);

                GUILayout.Space(-5);
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Draws the property.
 /// </summary>
 protected override void DrawPropertyLayout(IPropertyValueEntry <T> entry, GUIContent label)
 {
     if (GeneralDrawerConfig.Instance.UseImprovedEnumDropDown)
     {
         entry.SmartValue = EnumSelector <T> .DrawEnumField(label, entry.SmartValue);
     }
     else
     {
         entry.WeakSmartValue = SirenixEditorFields.EnumDropdown(label, (Enum)entry.WeakSmartValue);
     }
 }
Ejemplo n.º 6
0
        public ScrollModeTestGallery()
        {
            InitializeComponent();

            var scrollModeSelector = new EnumSelector <ItemsUpdatingScrollMode>(() => CollectionView.ItemsUpdatingScrollMode,
                                                                                mode => CollectionView.ItemsUpdatingScrollMode = mode, "SelectScrollMode");

            Grid.Children.Add(scrollModeSelector);

            CollectionView.ItemTemplate = ExampleTemplates.PhotoTemplate();
            CollectionView.ItemsSource  = _demoFilteredItemSource.Items;
        }
Ejemplo n.º 7
0
        static void PromptLoad(IDictionary <Option, IInputTool> options, IEnumSelector <Confirm> doLoad = null)
        {
            OpenFileDialog dialog;
            Character      loaded = null;

            if (doLoad == null)
            {
                doLoad = new EnumSelector <Confirm> {
                    Title = "Load character", Header = "Do you want to load a character? (from file)"
                }
            }
            ;
            if ((Confirm)doLoad.Activate().ObjValue == Confirm.Yes)
            {
                dialog = new OpenFileDialog();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    var json = File.ReadAllText(dialog.FileName);
                    loaded = JsonConvert.DeserializeObject <Character>(json);
                }

                if (loaded != null)
                {
                    Option opt = 0;
                    try
                    {
                        opt = Option.Name;
                        options[Option.Name].Cast <string>().Value = loaded.Name;
                        opt = Option.Age;
                        options[Option.Age].Cast <int>().Value = loaded.Age;
                        opt = Option.Gender;
                        (options[Option.Gender] as ISelector).Index = loaded.Gender;
                        opt = Option.Style;
                        (options[Option.Style] as ISelector).Index = loaded.Style;
                        opt = Option.Weapon;
                        options[Option.Weapon].Cast <Weapon>().Value = loaded.Weapon;
                        opt = Option.Armour;
                        options[Option.Armour].Cast <Armour>().Value = loaded.Armour;
                        opt = Option.Badges;
                        options[Option.Badges].Cast <Badges>().Value = loaded.Badges;
                    }
                    catch (ArgumentException)
                    {
                        doLoad.ErrorMessage = $"Data '{opt}' was corrupted in {dialog.FileName}.";
                        doLoad.HasError     = true;
                        PromptLoad(options, doLoad);
                    }
                }
            }
        }
        public SelectionModeGallery()
        {
            InitializeComponent();

            CollectionView.ItemTemplate = ExampleTemplates.PhotoTemplate();
            CollectionView.ItemsSource  = _demoFilteredItemSource.Items;

            var selectionModeSelector = new EnumSelector <SelectionMode>(() => CollectionView.SelectionMode,
                                                                         mode => CollectionView.SelectionMode = mode);

            Grid.Children.Add(selectionModeSelector);

            CollectionView.SelectionChanged       += CollectionViewOnSelectionChanged;
            CollectionView.SelectionChangedCommand = new Command(() =>
                                                                 SelectedItemsCommand.Text =
                                                                     $"SelectionChangedCommand, selection is: {((CollectionViewGalleryTestItem)CollectionView.SelectedItem).Caption}");
        }
Ejemplo n.º 9
0
        static Selector <PlayStyle> GeneratePlayStyleSelector()
        {
            var sel = new EnumSelector <PlayStyle>
            {
                Title         = "Play style",
                Header        = "Choose your playstyle",
                DisplayFormat = (style) =>
                {
                    switch (style)
                    {
                    case PlayStyle.Killer: return("♣ - Killer");

                    case PlayStyle.Achiever: return("♦ - Achiever");

                    case PlayStyle.Socializer: return("♥ - Socializer");

                    case PlayStyle.Explorer: return("♠ - Explorer");

                    default: return("");
                    }
                }
            };

            sel.PreviewTrigger = (s) =>
            {
                switch (s)
                {
                case PlayStyle.Killer:
                    sel.Footer = "Clubs (Killers) (♣) enjoy competition and take pleasure in causing physical destruction in the virtual environment."; break;

                case PlayStyle.Achiever:
                    sel.Footer = "Diamonds(Achievers) (♦) enjoy gaining points, levels, or any physical measure of their in-game achievement."; break;

                case PlayStyle.Socializer:
                    sel.Footer = "Hearts(Socializers) (♥) enjoy playing games for the social aspect or by interacting with other players."; break;

                case PlayStyle.Explorer:
                    sel.Footer = "Spades(Explorers) (♠) enjoy digging around, discovering new areas, or learning about easter eggs or glitches in the game."; break;

                default: break;
                }
            };
            sel.PreActivateTrigger = sel.PreviewTrigger;
            return(sel);
        }
Ejemplo n.º 10
0
        public SelectionModeGallery()
        {
            InitializeComponent();

            CollectionView.ItemTemplate = ExampleTemplates.PhotoTemplate();
            CollectionView.ItemsSource  = _demoFilteredItemSource.Items;

            var selectionModeSelector = new EnumSelector <SelectionMode>(() => CollectionView.SelectionMode,
                                                                         mode => CollectionView.SelectionMode = mode);

            Grid.Children.Add(selectionModeSelector);

            CollectionView.SelectionChanged       += CollectionViewOnSelectionChanged;
            CollectionView.SelectionChangedCommand = new Command(UpdateSelectionInfoCommand);

            UpdateSelectionInfo(Enumerable.Empty <CollectionViewGalleryTestItem>(), Enumerable.Empty <CollectionViewGalleryTestItem>());
            UpdateSelectionInfoCommand();
        }
Ejemplo n.º 11
0
        public static Selector <object> CreateMenu(string path, EnumSelector <Confirm> exit, IEnumerable <string> extensions)
        {
            var dir = new Directory()
            {
                Path = path
            };
            var menu = CreateMenuByDirectory(dir, extensions);

            if (menu != null)
            {
                menu.CancelTrigger = x => menu.Cancel = exit.Activate().Cast <Confirm>().Value == Confirm.Yes;
                menu.KeyPressActions[ConsoleKey.O] = (m) =>
                {
                    menu.Cancel        = true;
                    menu.CancelTrigger = (_) => { };
                };
            }
            return(menu);
        }
Ejemplo n.º 12
0
        public ScrollModeTestGallery(IItemsLayout itemsLayout = null, Func <DataTemplate> dataTemplate = null, Func <CollectionView> createCollectionView = null)
        {
            InitializeComponent();

            _collectionView             = createCollectionView == null ? new CollectionView() : createCollectionView();
            _collectionView.ItemsLayout = itemsLayout ?? LinearItemsLayout.Vertical;

            var scrollModeSelector = new EnumSelector <ItemsUpdatingScrollMode>(() => _collectionView.ItemsUpdatingScrollMode,
                                                                                mode => _collectionView.ItemsUpdatingScrollMode = mode, "SelectScrollMode");

            Grid.Children.Add(scrollModeSelector);


            Grid.Children.Add(_collectionView);
            Grid.SetRow(_collectionView, 5);

            _collectionView.ItemTemplate = dataTemplate == null?ExampleTemplates.PhotoTemplate() : dataTemplate();

            _collectionView.ItemsSource = _demoFilteredItemSource.Items;
        }
Ejemplo n.º 13
0
        static IInputToolSelector <IInputTool> GenerateMenu()
        {
            var options = GenerateOptions();
            var menu    = new InputToolSelector <IInputTool>(options.Values)
            {
                Title = "Main menu", Header = "Main menu"
            };
            var colorSelector = GenerateColorSelector(menu);

            SetupBadgesFooter((IFlagSelector <Badges>)options[Option.Badges]);

            PromptLoad(options);

            menu.PreActivateTrigger = (x) => menu.Footer = GetInfoString(options);
            var exit = new EnumSelector <Exit> {
                Header = "Exiting character creation"
            };
            Func <string> saveHeader = () => $"Do you want to save '{options[Option.Name].Cast<string>().Value}'?";
            var           save       = new EnumSelector <Confirm>()
            {
                Header = saveHeader()
            };

            save.PostActivateTrigger = (x) => { if (x == Confirm.Yes)
                                                {
                                                    Save(options);
                                                }
            };
            menu.ActUponInputToolTree(x => x.IfType <ISelector>(y => y.KeyPressActions[ConsoleKey.S] = (m) => save.Activate()));
            menu.ActUponInputToolTree(x => x.IfType <ISelector>(y => y.KeyPressActions[ConsoleKey.C] = (m) => colorSelector.Activate()));
            menu.CancelTrigger = (x) =>
            {
                exit.Activate();
                menu.Cancel = exit.Value != Exit.Cancel;
                if (exit.Value == Exit.SaveAndQuit)
                {
                    Save(options);
                }
            };
            return(menu);
        }
Ejemplo n.º 14
0
        public UngroupedReorderingGallery(IItemsLayout itemsLayout)
        {
            var layout = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    }
                }
            };

            var reorderCompletedLabel = new Label
            {
                Text = "ReorderCompleted (event): NA",
            };

            var itemTemplate = ExampleTemplates.SpacingTemplate();

            var collectionView = new CollectionView
            {
                ItemsLayout     = itemsLayout,
                ItemTemplate    = itemTemplate,
                AutomationId    = "collectionview",
                CanReorderItems = true
            };

            collectionView.ReorderCompleted += (sender, e) => reorderCompletedLabel.Text = $"ReorderCompleted (event): {DateTime.Now}";

            var generator = new ItemsSourceGenerator(collectionView, initialItems: 20, itemsSourceType: ItemsSourceType.ObservableCollection);

            var itemsSourceTypeSelector = new EnumSelector <ItemsSourceType>(() => generator.ItemsSourceType, sourceType => UpdateItemsSourceType(generator, sourceType, collectionView));

            var spacingModifier = new SpacingModifier(collectionView.ItemsLayout, "Update_Spacing");

            var reloadButton = new Button {
                Text = "Reload Current Source", AutomationId = "btnReload", HorizontalOptions = LayoutOptions.Start
            };

            reloadButton.Clicked += (sender, e) => ReloadItemsSource(collectionView);

            layout.Children.Add(generator);
            layout.Children.Add(itemsSourceTypeSelector);
            layout.Children.Add(spacingModifier);
            layout.Children.Add(reorderCompletedLabel);
            layout.Children.Add(reloadButton);
            layout.Children.Add(collectionView);

            Grid.SetRow(itemsSourceTypeSelector, 1);
            Grid.SetRow(spacingModifier, 2);
            Grid.SetRow(reorderCompletedLabel, 3);
            Grid.SetRow(reloadButton, 4);
            Grid.SetRow(collectionView, 5);

            Content = layout;

            generator.GenerateItems();
        }
Ejemplo n.º 15
0
        private void SetUpInput(DictionaryEntry[] parameters)
        {
            int yPos = 0;

            foreach (DictionaryEntry param in parameters)
            {
                if (TestController.TextInputParameters.Contains(param.Key.ToString()))
                {
                    TextInput inputX = new TextInput(param.Key.ToString());
                    inputX.ParameterValue = param.Value.ToString();
                    inputX.Location       = new Point(2, yPos);
                    inputX.Width          = pnlInput.Width - 4;
                    yPos = yPos + inputX.Height + 2;
                    this.pnlInput.Controls.Add(inputX);
                }
                else if (TestController.EnumParameters.Contains(param.Key.ToString()))
                {
                    EnumSelector inputY = new EnumSelector(param.Key.ToString());
                    inputY.ParameterValue = param.Value.ToString();
                    inputY.Location       = new Point(2, yPos);
                    inputY.Width          = pnlInput.Width - 4;
                    yPos = yPos + inputY.Height + 2;
                    this.pnlInput.Controls.Add(inputY);
                }
                else if (TestController.ContentParameters.Contains(param.Key.ToString()))
                {
                    switch (param.Key.ToString())
                    {
                    case "BatchXML":
                    {
                        // Generate BatchXML with a GUI
                        //BatchXML_GUI batchXMLControl = new BatchXML_GUI();

                        // Directly input BatchXML
                        TextInputMultiline batchXMLControl = new TextInputMultiline(param.Key.ToString());

                        batchXMLControl.Location = new Point(2, yPos);
                        batchXMLControl.Width    = pnlInput.Width - 4;
                        yPos = yPos + batchXMLControl.Height + 2;
                        this.pnlInput.Controls.Add(batchXMLControl);
                        break;
                    }

                    case "DocumentXML":
                    {
                        // Generate BatchXML with a GUI
                        //DocumentXML_GUI docXMLControl = new DocumentXML_GUI();

                        // Directly input BatchXML
                        TextInputMultiline docXMLControl = new TextInputMultiline(param.Key.ToString());

                        docXMLControl.Location = new Point(2, yPos);
                        docXMLControl.Width    = pnlInput.Width - 4;
                        yPos = yPos + docXMLControl.Height + 2;
                        this.pnlInput.Controls.Add(docXMLControl);
                        break;
                    }
                    }
                }
            }
            this.pnlInput.Height = yPos;
            int cont = this.pnlInput.Controls.Count;

            this.Height = this.pnlInput.Height + this.pnlDialogButtons.Height + 30;
        }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            Range.DefaultSlideWidth = 64;
            var red    = Range.New(0, 255, 1, Default: 0xFF, Title: "Primary color Red");
            var green  = Range.New(0, 255, 1, Default: 0xFF, Title: "Primary color Green");
            var blue   = Range.New(0, 255, 1, Default: 0xFF, Title: "Primary color Blue");
            var red2   = Range.New(0, 255, 1, Default: 0, Title: "Secondary color Red");
            var green2 = Range.New(0, 255, 1, Default: 0, Title: "Secondary color Green");
            var blue2  = Range.New(0, 255, 1, Default: 0, Title: "Secondary color Blue");

            red.SlideSplash = red2.SlideSplash = new Splash()
            {
                ForegroundColor = ConsoleColor.Red, BackgroundColor = ConsoleColor.DarkRed
            };
            green.SlideSplash = green2.SlideSplash = new Splash()
            {
                ForegroundColor = ConsoleColor.Green, BackgroundColor = ConsoleColor.DarkGreen
            };
            blue.SlideSplash = blue2.SlideSplash = new Splash()
            {
                ForegroundColor = ConsoleColor.Blue, BackgroundColor = ConsoleColor.DarkBlue
            };
            TextInput name = null;

            name = new TextInput(x =>
            {
                var chars = x.Intersect(Path.GetInvalidFileNameChars());

                if (x.Length == 0)
                {
                    name.ErrorMessage = $"Value cannot be empty";
                }
                else if (chars.Any())
                {
                    name.ErrorMessage = $"Remove: {Environment.NewLine}{string.Join(Environment.NewLine, chars)}";
                }
                else
                {
                    return(true);
                }
                return(false);
            })
            {
                Title  = "Finish",
                Header = "Choose filename:",
                Footer = "extension will be added (for example '.bmp')"
            };

            var options       = new IInputTool[] { red, green, blue, red2, green2, blue2, name };
            var imageSettings = new InputToolSelector <IInputTool>(options);
            var cancel        = new Selector <bool>(new bool[] { false, true })
            {
                Header = "Do you want to exit without saving?", DisplayFormat = x => x ? "Yes" : "No"
            };

            imageSettings.CancelTrigger = x => imageSettings.Cancel = cancel.Activate().IfType <Selector <bool> >(y => { }).Value;
            var bgsplash = new Splash()
            {
                ForegroundColor = ConsoleColor.DarkGray, BackgroundColor = ConsoleColor.Gray
            };

            imageSettings.ActUponInputToolTree(tool => tool.IfType <IRange <int> >(x =>
            {
                x.IncrementByModifiers[ConsoleModifiers.Control] = 5;
                x.IncrementByModifiers[ConsoleModifiers.Shift | ConsoleModifiers.Control] = 20;
                x.SlideBackgroundSplash = bgsplash;
                x.Header = x.Title;
            }));
            imageSettings.InputSplash.ForegroundColor = ConsoleColor.Cyan;
            name.PostActivateTrigger          = x => imageSettings.Cancel = true;
            name.FooterSplash.ForegroundColor = ConsoleColor.DarkGray;

            var format = new EnumSelector <ImageFormat> {
                Header = "Choose image format", InputSplash = imageSettings.InputSplash
            };

            while (true)
            {
                imageSettings.Activate();
                if (imageSettings.Cancel)
                {
                    return;
                }
                format.Activate();
                if (format.Cancel)
                {
                    continue;
                }

                var size   = 16;
                var drawer = new BitmapDrawer(name.Value, 32 * 8 * size, 32 * 5 * size)
                {
                    Iterations     = 64,
                    Zoom           = 4,
                    XScroll        = 0.45,
                    YScroll        = 0.05,
                    PrimaryColor   = Color.FromArgb(red.Value, green.Value, blue.Value),
                    SecondaryColor = Color.FromArgb(red2.Value, green2.Value, blue2.Value),
                    LimitAlpha     = 1,
                    ImageFormat    = format.Value
                };

                drawer.CreateImage();
                drawer.SaveImage();
                Process.Start($"{Directory.GetCurrentDirectory()}\\{drawer.FullFileName}");
                break;
            }
        }
Ejemplo n.º 17
0
        public SnapPointsCodeGallery(ItemsLayout itemsLayout)
        {
            Title = $"Snap Points (Code, {itemsLayout})";

            var layout = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    }
                }
            };

            itemsLayout.SnapPointsAlignment = SnapPointsAlignment.Start;
            itemsLayout.SnapPointsType      = SnapPointsType.None;

            var itemTemplate = ExampleTemplates.SnapPointsTemplate();

            var collectionView = new CollectionView
            {
                ItemsLayout  = itemsLayout,
                ItemTemplate = itemTemplate,
            };

            var generator = new ItemsSourceGenerator(collectionView, initialItems: 50);

            var snapPointsTypeSelector = new EnumSelector <SnapPointsType>(() => itemsLayout.SnapPointsType,
                                                                           type => itemsLayout.SnapPointsType = type);

            var snapPointsAlignmentSelector = new EnumSelector <SnapPointsAlignment>(() => itemsLayout.SnapPointsAlignment,
                                                                                     type => itemsLayout.SnapPointsAlignment = type);

            var flowDirectionSelector = new EnumSelector <FlowDirection>(() => layout.FlowDirection,
                                                                         type => layout.FlowDirection = type);

            layout.Children.Add(generator);
            layout.Children.Add(snapPointsTypeSelector);
            layout.Children.Add(snapPointsAlignmentSelector);
            layout.Children.Add(flowDirectionSelector);
            layout.Children.Add(collectionView);

            Grid.SetRow(snapPointsTypeSelector, 1);
            Grid.SetRow(snapPointsAlignmentSelector, 2);
            Grid.SetRow(flowDirectionSelector, 3);
            Grid.SetRow(collectionView, 4);

            Content = layout;

            generator.GenerateItems();
        }