Skip to content

Commit

Permalink
Added drop-down direction multi-choice option to sample
Browse files Browse the repository at this point in the history
We should make this scenario simpler, will open an issue.
  • Loading branch information
michael-hawker committed Jun 8, 2022
1 parent b122257 commit 3b9d3c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
mc:Ignorable="d">

<labs:Expander IsExpanded="False"
ExpandDirection="Down"
ExpandDirection="{x:Bind local:ExpanderFirstSamplePage.ConvertStringToDirection(ExpandDirection), Mode=OneWay}"
VerticalAlignment="Top"
Header="This text is in the header"
Content="This is in the content" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,23 @@
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
#endif
using MUXC = Microsoft.UI.Xaml.Controls;

namespace Expander.Sample;

namespace Expander.Sample
[ToolkitSampleMultiChoiceOption("ExpandDirection", title: "Expand Direction", "Down", "Up")]
[ToolkitSample(id: nameof(ExpanderFirstSamplePage), "Simple Expander", description: "A sample page for showing the Expander control.")]
public sealed partial class ExpanderFirstSamplePage : Page
{
[ToolkitSampleBoolOption("IsTextVisible", "IsVisible", true)]
// Single values without a colon are used for both label and value.
// To provide a different label for the value, separate with a colon surrounded by a single space on both sides ("label : value").
[ToolkitSampleMultiChoiceOption("TextSize", title: "Text size", "Small : 12", "Normal : 16", "Big : 32")]
[ToolkitSampleMultiChoiceOption("TextFontFamily", title: "Font family", "Segoe UI", "Arial", "Consolas")]
[ToolkitSampleMultiChoiceOption("TextForeground", title: "Text foreground",
"Teal : #0ddc8c",
"Sand : #e7a676",
"Dull green : #5d7577")]

[ToolkitSample(id: nameof(ExpanderFirstSamplePage), "Simple Options", description: "A sample page for showing how to do simple options.")]
public sealed partial class ExpanderFirstSamplePage : Page
public ExpanderFirstSamplePage()
{
public ExpanderFirstSamplePage()
{
this.InitializeComponent();
}
this.InitializeComponent();
}

public static MUXC.ExpandDirection ConvertStringToDirection(string direction) => direction switch
{
"Down" => MUXC.ExpandDirection.Down,
"Up" => MUXC.ExpandDirection.Up,
_ => throw new System.NotImplementedException(),
};
}
3 changes: 1 addition & 2 deletions labs/Expander/src/Expander.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media;
using MUXC = Microsoft.UI.Xaml.Controls;
#else
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using MUXC = Microsoft.UI.Xaml.Controls;
#endif
using MUXC = Microsoft.UI.Xaml.Controls;

namespace CommunityToolkit.Labs.WinUI;

Expand Down

0 comments on commit 3b9d3c6

Please sign in to comment.