|
| 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.Labs.WinUI.MarqueeTextRns; |
| 6 | + |
| 7 | +namespace MarqueeTextExperiment.Samples; |
| 8 | +[ToolkitSample(id: nameof(MarqueeTextSample), "MarqueeText", description: "A control for scrolling text in a marquee fashion.")] |
| 9 | +[ToolkitSampleNumericOption("MQSpeed", initial: 96, min: 48, max: 196, step: 1, Title = "Speed")] |
| 10 | +[ToolkitSampleMultiChoiceOption("MQDirection", "Left", "Right", "Up", "Down", Title = "Marquee Direction")] |
| 11 | +//[ToolkitSampleMultiChoiceOption("MarqueeRepeat", "Repeat", "Forever", "1x", "2x")] |
| 12 | +#if !HAS_UNO |
| 13 | +[ToolkitSampleMultiChoiceOption("MQBehavior", "Ticker", "Looping", "Bouncing", Title = "Marquee Behavior")] |
| 14 | +#else |
| 15 | +[ToolkitSampleMultiChoiceOption("MQBehavior", "Ticker", "Looping", Title = "Marquee Behavior")] |
| 16 | +#endif |
| 17 | +public sealed partial class MarqueeTextSample : Page |
| 18 | +{ |
| 19 | + public MarqueeTextSample() |
| 20 | + { |
| 21 | + this.InitializeComponent(); |
| 22 | + } |
| 23 | + |
| 24 | + private MarqueeBehavior ConvertStringToMarqueeBehavior(string str) => str switch |
| 25 | + { |
| 26 | + "Looping" => MarqueeBehavior.Looping, |
| 27 | + "Ticker" => MarqueeBehavior.Ticker, |
| 28 | +#if !HAS_UNO |
| 29 | + "Bouncing" => MarqueeBehavior.Bouncing, |
| 30 | +#endif |
| 31 | + _ => throw new System.NotImplementedException(), |
| 32 | + }; |
| 33 | + |
| 34 | + private MarqueeDirection ConvertStringToMarqueeDirection(string str) => str switch |
| 35 | + { |
| 36 | + "Left" => MarqueeDirection.Left, |
| 37 | + "Up" => MarqueeDirection.Up, |
| 38 | + "Right" => MarqueeDirection.Right, |
| 39 | + "Down" => MarqueeDirection.Down, |
| 40 | + _ => throw new System.NotImplementedException(), |
| 41 | + }; |
| 42 | +} |
0 commit comments