<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:WpfApplication1="clr-namespace:WpfApplication1"
Title="WPF" Height="100" Width="180">
<Window.Resources>
<ObjectDataProvider x:Key="daysData" MethodName="GetValues" ObjectType="{x:Type System:Enum}" >
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="WpfApplication1:DaysOfTheWeek"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
<StackPanel>
<TextBlock Margin="5" Text="Select the day of the week:"/>
<ComboBox Margin="5" ItemsSource="{Binding Source={StaticResource daysData}}" />
</StackPanel>
</Window>
//File:Window.xaml.cs
using System.Windows;
namespace WpfApplication1
{
public enum DaysOfTheWeek
{
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
}
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
}
}