Hello.
Voici mon soucis : j'ai une application vb/wpf (je sais, c# c'est mieux), et une classe classique "personne" qui implémente INotifyPropertyChanged.
Une des propriété est un enum public qui comporte 3 paramètres :
sur un usercontrol j'ai donc 3 checkbox pour lesquels je n'arrive pas à binder la propriété de type typepersonne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 enum typepersonne homme femme societe end enum
et dans le xaml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <ValueConversion(GetType(typepersonne), GetType(Boolean))> _ Public Class sexConvert : Implements IValueConverter Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert End Function Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack End Function End Class
je ne sais pas comment déclarer mon convertisseur dans :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <RadioButton IsChecked="{Binding Path=typepersonne , Mode=TwoWay, Converter={StaticResource sexConvert}, ConverterParameter=h}" Height="18" Margin="69,32,0,0" HorizontalAlignment="Left" Name="rdHomme" Width="75" VerticalAlignment="Top">Homme</RadioButton> <RadioButton IsChecked="{Binding Path=typepersonne , Mode=TwoWay, Converter={StaticResource sexConvert}, ConverterParameter=m}" Height="18" Margin="150,32,0,0" Name="rdFemme" VerticalAlignment="Top" HorizontalAlignment="Left" Width="79">Femme</RadioButton> <RadioButton IsChecked="{Binding Path=typepersonne , Mode=TwoWay, Converter={StaticResource sexConvert}, ConverterParameter=f}" Height="18" Margin="235,32,0,0" Name="rdSociete" VerticalAlignment="Top" HorizontalAlignment="Left" Width="93">Société</RadioButton>
<UserControl.Resources>
</UserControl.Resources>
message d'erreur :
converter ne prend pas en charge les valeurs de type system.windows.nullableboolconverter
Partager