<Window x:Class="ForeachSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="使用Foreach循环范例" Height="344" Width="513" FontSize="14">
    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/ForeachSample;component/Images/P1020452.JPG" />
        </Grid.Background>
        <ListBox Height="216" HorizontalAlignment="Left" Margin="26,54,0,0" Name="listFruits" VerticalAlignment="Top" Width="165" SelectionMode="Extended">
            <ListBoxItem Content="苹果" />
            <ListBoxItem Content="香蕉" />
            <ListBoxItem Content="西瓜" />
            <ListBoxItem Content="柳丁" />
            <ListBoxItem Content="番茄" />
            <ListBoxItem Content="杨桃" />
            <ListBoxItem Content="芭乐" />
            <ListBoxItem Content="椰子" />
            <ListBoxItem Content="凤梨" />
            <ListBoxItem Content="奇異果" />
            <ListBoxItem Content="葡萄" />
        </ListBox>
        <Label Content="请选取你喜欢的水果：" Height="28" HorizontalAlignment="Left" Margin="26,12,0,0" Name="label1" VerticalAlignment="Top" Width="165" />
        <Button Height="29" HorizontalAlignment="Left" Margin="197,127,0,0" Name="btnAdd" VerticalAlignment="Top" Width="97" Click="btnAdd_Click" Content="加入菜篮 --&gt;"></Button>
        <ListBox Height="216" HorizontalAlignment="Left" Margin="300,54,0,0" Name="listBuy" VerticalAlignment="Top" Width="165" />
        <Label Content="你已经选取的水果：" Height="28" HorizontalAlignment="Left" Margin="300,12,0,0" Name="label2" VerticalAlignment="Top" Width="165" />
    </Grid>
</Window>
