我们直接通过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>

 

 效果展示:WPF之 XAML集合项简单演示

 示例下载:

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

相关文章:

  • 2021-11-29
  • 2021-05-21
  • 2021-10-26
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2021-11-08
  • 2022-03-08
相关资源
相似解决方案