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

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

问题描述

一个ComboBox整数数组集的ItemsSource?


解决方案

 <窗​​口
    的xmlns =htt​​p://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
    的xmlns:X =htt​​p://schemas.microsoft.com/winfx/2006/xaml
    的xmlns:SYS =CLR的命名空间:系统;装配= mscorlib程序>
    < Window.Resources>
        < X:数组x:键=整数类型={X:键入SYS:的Int32}>
            < SYS:&的Int32 GT; 0℃; / SYS:&的Int32 GT;
            < SYS:的Int32> 1 LT; / SYS:&的Int32 GT;
            < SYS:的Int32> 2'; / SYS:&的Int32 GT;
        < / X:数组>
    < /Window.Resources>
    <组合框的ItemsSource ={绑定源= {StaticResource的整数}}/>
< /窗GT;

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天全站免登陆