将组合框的 ItemsSource 设置为整数数组? [英] Set ItemsSource of a ComboBox to an Array of Integers?

查看:19
本文介绍了将组合框的 ItemsSource 设置为整数数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将 ComboBox 的 ItemsSource 设置为整数数组?

Set ItemsSource of a ComboBox to an Array of Integers?

推荐答案

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">
    <Window.Resources>
        <x:Array x:Key="Integers" Type="{x:Type sys:Int32}">
            <sys:Int32>0</sys:Int32>
            <sys:Int32>1</sys:Int32>
            <sys:Int32>2</sys:Int32>
        </x:Array>
    </Window.Resources>
    <ComboBox ItemsSource="{Binding Source={StaticResource Integers}}" />
</Window>

这篇关于将组合框的 ItemsSource 设置为整数数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆