Bonjour à tous,
J'ai bien cherché une solution pour mon problème via google mais j'ai pas trouvé de problème identique. En gros je travaille sur une application wpf avec du databinding.
Le principe de cette partie du programme est d'afficher à l’écran dans des Label certaines valeur contenu dans un objet pour ce la j'utilise ce code :
Code XAML :
Code xaml : 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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 <ScrollViewer DataContext="{Binding CurrentAffaire}" x:Name="bandeau" HorizontalScrollBarVisibility="Disabled" Grid.ColumnSpan="2" Grid.Row="1" Visibility="Visible"> <Grid > <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="auto"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" HorizontalAlignment="Left" Name="image1" Stretch="Fill" VerticalAlignment="Stretch" Width="200" Source="/WpfApplication1;component/Ressources/Images/seca_sante.jpg" /> <StackPanel Grid.Column="1" HorizontalAlignment="Center"> <DockPanel HorizontalAlignment="Center"> <Label FontStyle="Normal" FontSize="16" Content="N° Affaire :" Foreground="White" /> <Label x:Name="lbNumAffaire" FontStyle="Italic" FontSize="16" Content="{Binding Path=Num, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> </DockPanel> <DockPanel Width="auto" HorizontalAlignment="Center"> <Label FontStyle="Normal" FontSize="16" Content="Client :" Foreground="White" /> <Label x:Name="lbNomClient" FontStyle="Italic" FontSize="16" Content="{Binding Path=NomClient, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> </DockPanel> </StackPanel> <StackPanel Grid.Column="2" HorizontalAlignment="Right"> <DockPanel> <Label FontStyle="Normal" FontSize="16" Content="Indice :" Foreground="White" /> <Label x:Name="lbIndiceAffaire" FontStyle="Italic" FontSize="16" Content="{Binding Path=Indice, Mode=TwoWay}" /> </DockPanel> <DockPanel> <Label FontStyle="Normal" FontSize="16" Content="Date d'édition :" Foreground="White" /> <Label x:Name="lbDate" Margin="0,0,8,0" FontStyle="Italic" FontSize="16" Content="{Binding Path=DateEdition, Mode=TwoWay}" /> </DockPanel> </StackPanel> </Grid> </ScrollViewer>
En gros j'ai bindé mes label avec un objet qui s'appelle "currentAffaire", lors du démarrage l'attribution des valeurs se fait très bien (j'initialise avec des valeur de test lors de l’instanciation dans le constructeur de ma classe).
Mon problème est que lorsque je modifie la valeur de mon objet currentAffaire, les valeurs dans mes labels ne changent pas ....
Donc voila ça fait plusieurs heures que je penche la dessus sans succès.
Partager