Skip to content

Commit 08bbe58

Browse files
Clean-up sample and better separate the two examples
1 parent 332fd2c commit 08bbe58

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Primitives/SwitchPresenter.bind

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</ComboBox>
2020
<!-- SwitchPresenter binds to a value -->
2121
<controls:SwitchPresenter Value="{Binding SelectedItem, ElementName=Lookup}">
22-
<!-- And then only dynamically displays the Case with matching Value -->
22+
<!-- And then only dynamically displays the Case with the matching Value -->
2323
<controls:Case Value="Confirmation Code">
2424
<StackPanel>
2525
<TextBox Name="ConfirmationCodeValidator"
@@ -43,26 +43,36 @@
4343
Header="Mileage Plan #"
4444
PlaceholderText="Mileage Plan #" />
4545
</controls:Case>
46+
<!-- You can also provide a default case if no match is found -->
4647
<controls:Case IsDefault="True">
4748
<TextBlock>Please select a way to lookup your reservation above...</TextBlock>
4849
</controls:Case>
4950
</controls:SwitchPresenter>
50-
51-
<!-- Advanced scenario using Type information -->
51+
52+
<Border Height="2" Background="Gray" Margin="0,16"/>
53+
54+
<!-- Scenario using an Enum -->
5255
<ComboBox x:Name="AnimalPicker"
5356
Header="Pick an Animal"
5457
ItemsSource="{ui:EnumValues Type=enums:Animal}"
5558
SelectedIndex="0"/>
5659
<controls:SwitchPresenter Value="{Binding SelectedItem, ElementName=AnimalPicker}"
57-
TargetType="enums:Animal">
60+
TargetType="enums:Animal"
61+
Padding="16">
5862
<controls:Case Value="Cat">
59-
<TextBlock>🐈</TextBlock>
63+
<TextBlock FontSize="32">🐈</TextBlock>
6064
</controls:Case>
6165
<controls:Case Value="Dog">
62-
<TextBlock>🐕</TextBlock>
66+
<TextBlock FontSize="32">🐕</TextBlock>
6367
</controls:Case>
6468
<controls:Case Value="Bunny">
65-
<TextBlock>🐇</TextBlock>
69+
<TextBlock FontSize="32">🐇</TextBlock>
70+
</controls:Case>
71+
<controls:Case Value="Parrot">
72+
<TextBlock FontSize="32">🦜</TextBlock>
73+
</controls:Case>
74+
<controls:Case Value="Squirrel">
75+
<TextBlock FontSize="32">🐿</TextBlock>
6676
</controls:Case>
6777
</controls:SwitchPresenter>
6878
</StackPanel>

0 commit comments

Comments
 (0)