>>Hi,
>>
>>I have the following enum defined:
>>
>>
public enum RateType : int
>> {
>> Standard = 1,
>> Mail = 2,
>> ZipX = 3
>> }
>>
>>I need to let the user pick form a combo whether the rate is one of these (standard, Mail or ZipX) and store the int value back to the database.
>>
>>How would I define this in xaml?
>>
>>Something like this:
>>
>>
<ComboBox Grid.Column="1" Grid.Row="1" Margin="0" Name="cboRateTypes" SelectedValue="{Binding rat_type, Mode=Default}" VerticalAlignment="Center" ItemsSource="{Binding}">
>> <ComboBoxItem Content="Standard" />
>> <ComboBoxItem Content="Mail" />
>> <ComboBoxItem Content="ZipX" />
>> </ComboBox>
>
>MarkupExtension is one way to go. The first answer here gives an example which would work with any enum:
>
http://stackoverflow.com/questions/58743/databinding-an-enum-property-to-a-combobox-in-wpf>
>Or using ObjectDataProvider:
>
http://www.codeproject.com/Articles/29495/Binding-and-Using-Friendly-Enums-in-WPF>
>Both may look more complex than what you are looking for but will be useful again and again....
Thanks Viv,
much more complicated than the old VFP combo :(
I'll see if I can work out how to implement this.