<StackPanel> <ComboBoxx:Name="Lookup" Margin="0,0,0,8" Header="Look up reservation" SelectedIndex="0"> <x:String>Select an option</x:String> <x:String>Confirmation Code</x:String> <x:String>E-ticket number</x:String> <x:String>Mileage Plan number</x:String> </ComboBox> <!-- SwitchPresenter binds to a value --> <wuc:SwitchPresenterValue="{Binding SelectedItem, ElementName=Lookup}"> <!-- And then only dynamically displays the Case with the matching Value --> <wuc:CaseValue="Confirmation Code"> <StackPanel> <TextBoxName="ConfirmationCodeValidator" ui:TextBoxExtensions.Regex="^[a-zA-Z]{6}$" Header="Confirmation code" PlaceholderText="6 letters" /> <TextBlockText="Thanks for entering a valid code!" Visibility="{Binding (ui:TextBoxExtensions.IsValid), ElementName=ConfirmationCodeValidator}" /> </StackPanel> </wuc:Case> <wuc:CaseValue="E-ticket number"> <StackPanel> <TextBoxName="TicketValidator" ui:TextBoxExtensions.Regex="(^\d{10}$)|(^\d{13}$)" Header="E-ticket number" PlaceholderText="10 or 13 numbers" /> <TextBlockText="Thanks for entering a valid code!" Visibility="{Binding (ui:TextBoxExtensions.IsValid), ElementName=TicketValidator}" /> </StackPanel> </wuc:Case> <wuc:CaseValue="Mileage Plan number"> <TextBoxName="PlanValidator" Header="Mileage Plan #" PlaceholderText="Mileage Plan #" /> </wuc:Case> <!-- You can also provide a default case if no match is found --> <wuc:CaseIsDefault="True"> <TextBlockText="Please select a way to lookup your reservation above..." /> </wuc:Case> </wuc:SwitchPresenter> </StackPanel>
<Page.Resources> <!-- If you reference an enum directly in UWP, you need to use it somewhere for the XamlTypeInfo reference to be generated... --> <local:Animalx:Key="MyAnimal">Cat</local:Animal> </Page.Resources>