Bonjour à toutes et à tous,

Soit une application utilisant MVVM light 5.
J'ai ajouté une classe AppViewModelBase afin de compléter ViewModelBase et de faciliter l'affichage du curseur et du TaskbarItemInfo pour toute l'application.

Le AppViewModelBase
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using GalaSoft.MvvmLight;
 
namespace ConversionTER.ViewModel
{
    public class AppViewModelBase : ViewModelBase
    {
        private bool _isWorking = false;
        public bool IsWorking
        {
            get { return _isWorking; }
            set
            {
                if (_isWorking != value)
                {
                    _isWorking = value;
                    RaisePropertyChanged(() => IsWorking);
                    if (_isWorking)
                    {
                        Cursor = System.Windows.Input.Cursors.Wait;
                        IconeApplicationTaskBar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
                        RaisePropertyChanged(() => IconeApplicationTaskBar);
                    }
                    else
                    {
                        Cursor = System.Windows.Input.Cursors.Arrow;
                        IconeApplicationTaskBar.ProgressState = System.Windows.Shell.TaskbarItemProgressState.Indeterminate;
                        RaisePropertyChanged(() => IconeApplicationTaskBar);
                    }
                }
            }
        }
 
 
        private System.Windows.Input.Cursor _cursor = System.Windows.Input.Cursors.Arrow;
        public System.Windows.Input.Cursor Cursor
        {
            get { return _cursor; }
            set
            {
                if (_cursor != value)
                {
                    _cursor = value;
                    RaisePropertyChanged(() => Cursor);
                }
            }
        }
 
 
        private System.Windows.Shell.TaskbarItemInfo _iconeApplicationTaskBar;
        public System.Windows.Shell.TaskbarItemInfo IconeApplicationTaskBar
        {
            get
            {
                if (_iconeApplicationTaskBar == null)
                    return new System.Windows.Shell.TaskbarItemInfo();
                return _iconeApplicationTaskBar;
            }
            set
            {
                if (_iconeApplicationTaskBar == value)
                    return;
                _iconeApplicationTaskBar = value;
                RaisePropertyChanged(() => IconeApplicationTaskBar);
            }
        }
    }
}
mon MainWindow.xaml
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
35
36
37
<Window x:Class="ConversionTER.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ignore="http://www.galasoft.ch/ignore"
        mc:Ignorable="d ignore"
        Height="650"
        Width="600"
        Title="{Binding Titre}"
        DataContext="{Binding Main, Source={StaticResource Locator}}"
        MinHeight="650"
        MinWidth="600"
        Cursor="{Binding Cursor}">
 
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
 
 
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo ProgressState="{Binding IconeApplicationTaskBar.ProgressState}" />
    </Window.TaskbarItemInfo>
 
 
     <Grid x:Name="LayoutRoot">
 
 
        <ContentControl Content="{Binding conversionViewModel}" />
 
 
    </Grid>
</Window>
Son MainViewModel.cs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using GalaSoft.MvvmLight;
using ConversionTER.Model;
 
 
namespace ConversionTER.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// See http://www.mvvmlight.net
    /// </para>
    /// </summary>
    public class MainViewModel : AppViewModelBase
    {
        private readonly IDataService _dataService;
 
 
        private string _titre = "Conversion TER";
        public string Titre
        {
            get
            {
                return _titre;
            }
            set
            {
                if (_titre == value)
                    return;
                _titre = value;
                RaisePropertyChanged(() => Titre);
            }
        }
 
 
        readonly static ConversionTERViewModel _conversionTERviewModel = new ConversionTERViewModel();
        private ViewModelBase _conversionviewModel;
        public ViewModelBase conversionViewModel
        {
            get
            {
                return _conversionviewModel;
            }
            set
            {
                if (_conversionviewModel == value)
                    return;
                _conversionviewModel = value;
                RaisePropertyChanged(() => conversionViewModel);
            }
        }
 
 
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IDataService dataService)
        {
            _dataService = dataService;
            _dataService.GetData(
                (item, error) =>
                {
                    if (error != null)
                    {
                        // Report error here
                        return;
                    }
 
 
                });
            Titre = string.Format("Conversion TER (v {0})", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
            conversionViewModel = MainViewModel._conversionTERviewModel;
        }
 
 
        ////public override void Cleanup()
        ////{
        ////    // Clean up if needed
 
 
        ////    base.Cleanup();
        ////}
    }
}
Ni le curseur ni le TaskBarItemInfo ne se mettent à jour dans le MainWindow.xaml.
Si je mets le Cursor="{Binding Cursor}" dans l'entête du xaml du userControl correspondant au conversionViewModel (<ContentControl Content="{Binding conversionViewModel}" />) au lieu de l'entête du MainWindow.xaml, il se met à jour.
Je ne comprend vraiment pas pourquoi le MainWindow.xaml ne se met pas à jour.
Qu'est-ce que je fais mal, et donc comment devrais-je faire pour que le cursor et le TaskBarItemInfo se mettent à jour dans le MainWindow.xaml ?

Merci de vos z'avis z'avisés.