Last active
August 29, 2015 14:01
-
-
Save RinatMullayanov/1d887c1c54b19cabb2ea to your computer and use it in GitHub Desktop.
WPF XAML Enum ComboBox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- create combobox from enum--> | |
<prism:PrismView.Resources> | |
<!--для биндинга к Enum--> | |
<ObjectDataProvider MethodName="GetValues" | |
ObjectType="{x:Type sys:Enum}" | |
x:Key="WriterEnumDataProvider"> | |
<ObjectDataProvider.MethodParameters> | |
<x:Type TypeName="local:WriterEnum" /> | |
</ObjectDataProvider.MethodParameters> | |
</ObjectDataProvider> | |
</prism:PrismView.Resources> | |
<!-- ...--> | |
<ComboBox ItemsSource="{Binding Source={StaticResource WriterEnumDataProvider}}" | |
SelectedItem="{Binding SelectedSignal.WriterId, Mode=TwoWay}" | |
HorizontalAlignment="Left" Width="150" > | |
<ComboBox.ItemTemplate> | |
<DataTemplate> | |
<TextBlock Text="{Binding}"/> | |
</DataTemplate> | |
</ComboBox.ItemTemplate> | |
</ComboBox> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment