Skip to content

Sample project for navigation using Avalonia 11 with CommunityToolkit.MVVM.

License

Notifications You must be signed in to change notification settings

JohnKesko/Avalonia.Navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avalonia.Navigation

Simple project to use navigation in Avalonia 11 with CommunityToolkit.MVVM.

  • Avalonia 11.0.2
  • CommunityToolKit.MVVM 8.2.1

The OG implementation using ReactiveUI.


With CommunityToolkit.MVVM

In this sample, the MainWindow.axaml changes the "CurrentPage", which is a UserControl within the MainWindow.

To change the view, we have two options:

    <Grid RowDefinitions="*,Auto" Margin="10">

        <!-- <ContentControl Content="{Binding CurrentPage}" /> -->
        <TransitioningContentControl Content="{Binding CurrentPage}" /> 
        
        <StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="5" HorizontalAlignment="Right">
            
            <Button Command="{Binding NavigatePreviousCommand}" Content="Back" />
            <Button Command="{Binding NavigateNextCommand}" Content="Next" />
            
        </StackPanel>

    </Grid>

Page 1:

Page 2 Validation = false

We can't navigate to the next page until the validation is met.

Page 2 Validation = true:

Page 3 When there are no more pages, show a message.

About

Sample project for navigation using Avalonia 11 with CommunityToolkit.MVVM.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages