|
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | 3 | // See the LICENSE file in the project root for more information. |
4 | 4 |
|
| 5 | +using CommunityToolkit.Labs.WinUI.MarqueeTextRns; |
| 6 | + |
5 | 7 | namespace MarqueeTextExperiment.Samples; |
6 | 8 | [ToolkitSample(id: nameof(MarqueeTextSample), "MarqueeText", description: "A control for scrolling text in a marquee fashion.")] |
7 | | -[ToolkitSampleMultiChoiceOption("MarqueeSpeed", "Speed", "Slow : 64", "Medium : 96", "Fast : 128")] |
8 | | -//[ToolkitSampleMultiChoiceOption("MarqueeMode", "Mode", "Ticker", "Looping", "Bouncing")] |
9 | | -//[ToolkitSampleMultiChoiceOption("MarqueeDirection", "Direction", "Left", "Right", "Up", "Down")] |
10 | | -[ToolkitSampleMultiChoiceOption("MarqueeRepeat", "Repeat", "Forever", "1x", "2x")] |
| 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 |
11 | 17 | public sealed partial class MarqueeTextSample : Page |
12 | 18 | { |
13 | 19 | public MarqueeTextSample() |
14 | 20 | { |
15 | 21 | this.InitializeComponent(); |
16 | 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 | + }; |
17 | 42 | } |
0 commit comments