Bonjour,

Petite question pour passer d'une fenêtre à une autre mais juste en changeant le content et en passant par du MVVM.
J'ai fait un petit projet pour tester ça :

1ère fenêtre :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
<Window x:Class="DocContent.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <TextBox x:Name="toCheck" Width="200" Height="23" />
        <Button Content="Next" Width="40" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="5" Command="{Binding CmdNextPage}" />
    </Grid>
</Window>
2ème fenêtre :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
<UserControl x:Class="DocContent.Window2"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <TextBlock Text="Page 2" Background="Blue" Foreground="Yellow" Width="200" Height="30" />            
    </Grid>
</UserControl>
et une classe pour le viewmodel avec la fonction quand on appuie sur le bouton next :

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
 
private RelayCommand cmdNextPage;
        public ICommand CmdNextPage
        {
            get
            {
                if (this.cmdNextPage == null)
                {
                    this.cmdNextPage = new RelayCommand(x => this.cmdNextPageFct());
                }
                return this.cmdNextPage;
            }
        }
 
        private void cmdNextPageFct()
        {
 
        }
Ce que j'aimerais c'est passer d'une page à l'autre mais sans changer de fenêtre...