| 
 | 1 | +// Licensed to the .NET Foundation under one or more agreements.  | 
 | 2 | +// The .NET Foundation licenses this file to you under the MIT license.  | 
 | 3 | +// See the LICENSE file in the project root for more information.  | 
 | 4 | + | 
 | 5 | +using CommunityToolkit.WinUI.Controls;  | 
 | 6 | + | 
 | 7 | +namespace MarqueeExperiment.Samples;  | 
 | 8 | + | 
 | 9 | +[ToolkitSample(id: nameof(MarqueeTextSample), "Marquee", description: "A control for scrolling content in a marquee fashion.")]  | 
 | 10 | +[ToolkitSampleNumericOption("MQSpeed", initial: 96, min: 48, max: 196, step: 1, Title = "Speed")]  | 
 | 11 | +[ToolkitSampleMultiChoiceOption("MQDirection", "Left", "Right", "Up", "Down", Title = "Marquee Direction")]  | 
 | 12 | +[ToolkitSampleTextOption("MQText", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")]  | 
 | 13 | +//[ToolkitSampleMultiChoiceOption("MarqueeRepeat", "Repeat", "Forever", "1x", "2x")]  | 
 | 14 | +#if !HAS_UNO  | 
 | 15 | +[ToolkitSampleMultiChoiceOption("MQBehavior", "Ticker", "Looping", "Bouncing", Title = "Marquee Behavior")]  | 
 | 16 | +#else  | 
 | 17 | +[ToolkitSampleMultiChoiceOption("MQBehavior", "Ticker", "Looping", Title = "Marquee Behavior")]  | 
 | 18 | +#endif  | 
 | 19 | +public sealed partial class MarqueeTextSample : Page  | 
 | 20 | +{  | 
 | 21 | +    public MarqueeTextSample()  | 
 | 22 | +    {  | 
 | 23 | +        this.InitializeComponent();  | 
 | 24 | +    }  | 
 | 25 | + | 
 | 26 | +    private MarqueeBehavior ConvertStringToMarqueeBehavior(string str) => str switch  | 
 | 27 | +    {  | 
 | 28 | +        "Looping" => MarqueeBehavior.Looping,  | 
 | 29 | +        "Ticker" => MarqueeBehavior.Ticker,  | 
 | 30 | +#if !HAS_UNO  | 
 | 31 | +        "Bouncing" => MarqueeBehavior.Bouncing,  | 
 | 32 | +#endif  | 
 | 33 | +        _ => throw new System.NotImplementedException(),  | 
 | 34 | +    };  | 
 | 35 | + | 
 | 36 | +    private MarqueeDirection ConvertStringToMarqueeDirection(string str) => str switch  | 
 | 37 | +    {  | 
 | 38 | +        "Left" => MarqueeDirection.Left,  | 
 | 39 | +        "Up" => MarqueeDirection.Up,  | 
 | 40 | +        "Right" => MarqueeDirection.Right,  | 
 | 41 | +        "Down" => MarqueeDirection.Down,  | 
 | 42 | +        _ => throw new System.NotImplementedException(),  | 
 | 43 | +    };  | 
 | 44 | +}  | 
0 commit comments