Using MEF in a Windows Store App: Listing 3

MainPage.xaml with Grid.

<Page
    x:Class="VSMMefDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:VSMMefDemo"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <StackPanel HorizontalAlignment="Center" Margin="0,20,0,20">
            <TextBlock>Input</TextBlock>
            <TextBox Name="Input" MinWidth="300"></TextBox>
            <TextBlock>Select a Validation Type</TextBlock>
            <ComboBox Name="ValidationTypes" ItemsSource="{Binding}" DisplayMemberPath="Metadata"
                      SelectedValuePath="Value" 
                      SelectionChanged="ValidationTypes_SelectionChanged"></ComboBox>
            <Button Name="Validate" Click="Validate_Click">Valiate</Button>
            <TextBlock>Result</TextBlock>
            <TextBlock Name="Result"></TextBlock>
    </StackPanel>
    </Grid>
</Page>

About the Author

Eric Vogel is a Sr. Software Developer at Kunz, Leigh, & Associates in Okemos, MI. He is the president of the Greater Lansing User Group for .NET. Eric enjoys learning about software architecture and craftsmanship, and is always looking for ways to create more robust and testable applications. Contact him at vogelvision@gmail.com.