Created
April 21, 2017 08:55
-
-
Save hilapon/62c68003f07e7bd834f5630c6b865ca5 to your computer and use it in GitHub Desktop.
[WPF] ComboBox と Enum のバインドのサンプル (View)
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
<Window.Resources> | |
<ObjectDataProvider x:Key="sampleenums" MethodName="GetValues" ObjectType="{x:Type local:SampleEnum}"> | |
<ObjectDataProvider.MethodParameters> | |
<x:Type TypeName="local:SampleEnum"/> | |
</ObjectDataProvider.MethodParameters> | |
</ObjectDataProvider> | |
<local:ModeConverter x:Key="modeConverter"/> | |
</Window.Resources> | |
<Grid> | |
<ComboBox x:Name="comboBox" Height="26" Width="150" | |
VerticalContentAlignment="Center" | |
ItemsSource="{Binding Source={StaticResource sampleenums}}"> | |
<ComboBox.ItemTemplate> | |
<DataTemplate> | |
<TextBlock Text="{Binding Converter={StaticResource modeConverter}}" /> | |
</DataTemplate> | |
</ComboBox.ItemTemplate> | |
</ComboBox> | |
</Grid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment