WPF之 XAML集合项简单演示

我们直接通过xaml文件演示一个简单的xaml集合项:

<Window x:Class="WPF_XAML集合项.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">

        <Grid>
        <ComboBox Height="25" HorizontalAlignment="Left" Margin="50,30,0,0" Name="comboBox1" VerticalAlignment="Top" Width="216" >
            <ComboBox.Items>
                <!--集合项-->
                <ComboBoxItem>中国</ComboBoxItem>
                <ComboBoxItem>美国</ComboBoxItem>
                <ComboBoxItem>日本</ComboBoxItem>
                <!--文本-->
                <TextBlock>A</TextBlock>
                <TextBlock>B</TextBlock>
                <TextBlock>C</TextBlock>
                <TextBlock Height="75" Text="你好" FontFamily="Agency FB" FontSize="20">
            <TextBlock.Foreground>
                <ImageBrush ImageSource="123.jpg" />        
            </TextBlock.Foreground>
                </TextBlock>
                <!--图片-->
                <Image Source="123.jpg" Height="50" Width="40"></Image>
                <!--自定义图形-->
                <Rectangle Width="40" Height="40" Fill="Blue"></Rectangle>
        
            </ComboBox.Items>
        </ComboBox>
       
    </Grid>
</Window>

 效果展示:

 示例下载:

http://files.cnblogs.com/BABLOVE/WPFXAML%E9%9B%86%E5%90%88%E9%A1%B9.rar

原文地址:https://www.cnblogs.com/BABLOVE/p/3231540.html