Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set ItemsSource of a ComboBox to an Array of Integers?

Set ItemsSource of a ComboBox to an Array of Integers?

like image 604
Shimmy Weitzhandler Avatar asked Dec 01 '09 11:12

Shimmy Weitzhandler


1 Answers

<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>
like image 92
Shimmy Weitzhandler Avatar answered Oct 02 '22 07:10

Shimmy Weitzhandler