Bonjour,
Dans un datagrid ou j'ai mes employes, j'ai un textBox et un bouton.
Le textBox reprend le nom de mon login asp s'il existe.
Je voudrais que le bouton affiche l'image d'un "plus" si le textBox ne contient pas de login, et l'image d'une "croix" (pour effacer) s'il en contient un.
Mon converter est le suivant:
Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public class PlusOuMoinsImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return ((string)value == "") ? "/monAppli;Component/Images/Add.png" : "/monAppli;Component/Images/Delete.png"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }
quand dans mon XAML, je mets:
Code xaml : Sélectionner tout - Visualiser dans une fenêtre à part <Image Height="19" Width="22" Source="{Binding aspnet_Users.UserName, Converter={StaticResource locPlusOuMoinsImageConverter}}" Stretch="Fill" Margin="5,0"/>
Celà m'affiche bien la "croix" quand j'ai un login dans aspnet_Users.UserName, mais quand je n'ai pas de login, il ne passe même pas dans mon converter, donc il ne m'affiche jamais mon "plus"
Partager