Hello,

Je souhaite faire un truc tout simple mais je n'y arrive pas
J'aimerais que la modification d'une DependencyProperty entraine la modification d'une autre.

Dans mon ViewModel, j'ai

Code : 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
public static readonly DependencyProperty UnderlyingSelectedProperty = DependencyProperty.Register
            (
                "UnderlyingSelected",
                typeof(Underlying),
                typeof(MainViewModel),
                new PropertyMetadata(null, OnUnderlyingSelectedChanged)
            );
         public Underlying UnderlyingSelected
        {
            get { return (Underlying)GetValue(UnderlyingSelectedProperty); }
            set { SetValue(UnderlyingSelectedProperty, value); }
        }
        public static void OnUnderlyingSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var ul = e.NewValue as Underlying;
            if (ul != null)
            {
               // Modifier PricingTask
            }
        }   
 
 public static readonly DependencyProperty PricingTaskProperty = DependencyProperty.Register
            (
                "PricingTask",
                typeof(PricingTaskDTO),
                typeof(MainViewModel),
                new PropertyMetadata(null)
            );
         public PricingTaskDTO PricingTask
        {
            get { return (PricingTaskDTO)GetValue(PricingTaskProperty); }
            set { SetValue(PricingTaskProperty, value); }
        }
Le problème est que OnUnderlyingSelectedChanged est static, donc je n'ai pas accès à PricingTask.
Ca doit être tout con mais je ne trouve pas alors merci à celui qui m'aidera