WPF frame navigate and listbox contains icon and title to implement quick navigation, listbox can expand and shrink

//Mainwindow.xaml
<Window x:Class="WpfApp15.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:behavior="http://schemas.microsoft.com/xaml/behaviors"
        WindowState="Maximized"
        xmlns:local="clr-namespace:WpfApp15"
        xmlns:localPages="clr-namespace:WpfApp15.Pages"
        mc:Ignorable="d"
        KeyDown="Window_KeyDown"
        Title="MainWindow" Height="450" Width="800">
    <behavior:Interaction.Triggers>
        <behavior:EventTrigger EventName="KeyDown">
            <behavior:InvokeCommandAction Command="{Binding KeyDownCommand}"
                                          PassEventArgsToCommand="True"/>
        </behavior:EventTrigger>
    </behavior:Interaction.Triggers>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300" x:Name="firstColumn"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Button Grid.Row="0"
                Grid.Column="0"
                Content="{Binding BtnContent,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                Command="{Binding BtnToggleCommand}"
                />
        <DockPanel Grid.Row="1"
                   Grid.Column="0">
            <ListBox x:Name="lbx"
                     ItemsSource="{Binding BooksCollection,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                     SelectedIndex="{Binding LbxSelectedIdx,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                     SelectedItem="{Binding SelectedBook,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                <behavior:Interaction.Triggers>
                    <behavior:EventTrigger EventName="SelectionChanged">
                        <behavior:InvokeCommandAction Command="{Binding LbxSelectionChangedCommand}"
                                          PassEventArgsToCommand="True"/>
                    </behavior:EventTrigger>
                </behavior:Interaction.Triggers>
                <ListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="FontSize" Value="20"/>
                        <Style.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="FontSize" Value="30"/>
                                <Setter Property="FontWeight" Value="ExtraBold"/>
                                <Setter Property="FontStretch" Value="UltraExpanded"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Image Grid.Column="0"
                                Source="{Binding DataContext.ImgSource,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,
                                RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}"
                                Width="30"
                                Height="30"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"/>
                            <TextBlock 
                                Grid.Column="1"
                                Text="{Binding DataContext.Title,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,
                                RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}"/>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </DockPanel>

        <!--Source="pack://application:,,,/Pages/MainPageView.xaml"-->
        <Frame x:Name="mainFrame"
               NavigationUIVisibility="Hidden"
               Grid.Row="0"
               Grid.RowSpan="2"
               Grid.Column="1"
               BorderBrush="Blue"
               BorderThickness="3"/>
    </Grid>
</Window>


//mainwindow.cs
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xaml;
using WpfApp15.Pages;
using static System.Net.Mime.MediaTypeNames;

namespace WpfApp15
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private List<Page> pagesList = new List<Page>();
        private MainVM vm;
        public MainWindow()
        {
            InitializeComponent();
            vm = MainVM.GetVMInstance(this, mainFrame);
            this.DataContext = vm;
        }

        int idx = 0;
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Right)
            {
                if (++idx >= pagesList.Count)
                {
                    idx = 0;
                }
                mainFrame.Navigate(pagesList[idx]);
                if (mainFrame.CanGoForward)
                {
                    mainFrame.GoForward();
                }
            }
            else if (e.Key == Key.Left)
            {
                if (--idx < 0)
                {
                    idx = pagesList.Count - 1;
                }
                mainFrame.Navigate(pagesList[idx]);
            }
            else if (e.Key == Key.Enter)
            {
                mainFrame.Navigate(this);
            }

            System.Windows.Application.Current?.Dispatcher.BeginInvoke(new Action(() =>
            {
                this.Title = (idx + 1).ToString();
            }));
        }
    }

    public class MainVM : INotifyPropertyChanged
    {
        public Window win;
        private NavigationService navService;
        private List<Page> pagesList = new List<Page>();
        public static MainVM VMInstance { get; private set; }
        private static object objLock = new object();
        public Frame mainFrame;
        private Page mainPage;
        private static ColumnDefinition firstCol;
        private GridLengthAnimation gridLengthAnimation;
        private GridLength longGridLen = new GridLength(300);
        private GridLength shortGridLen = new GridLength(40);
        private MainVM()
        {
            Init();
        }

        private void Init()
        {
            InitPagesList();
            InitBooksCollection();
            BtnContent = "";            
            gridLengthAnimation = new GridLengthAnimation();
            gridLengthAnimation.Duration = TimeSpan.FromSeconds(1);
        }

        private void InitBooksCollection()
        {   
            var imgDir = @"../../../Images";
            if(Directory.Exists(imgDir))
            {
                var imgs=Directory.GetFiles(imgDir);
                int imgsCount = imgs.Count();
                BooksCollection = new ObservableCollection<Book>();
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/12.jpg"),
                    Title = "MainPageView"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/1.jpg"),
                    Title = "Page1"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/2.jpg"),
                    Title = "Page2"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/3.jpg"),
                    Title = "Page3"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/4.jpg"),
                    Title = "Page4"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/5.jpg"),
                    Title = "Page5"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/6.jpg"),
                    Title = "Page6"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/7.jpg"),
                    Title = "Page7"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/8.jpg"),
                    Title = "Page8"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/9.jpg"),
                    Title = "Page9"
                });
                BooksCollection.Add(new Book()
                {
                    ImgSource = GetImgSourceViaUrl(@"../../../Images/10.jpg"),
                    Title = "Page10"
                });
                SelectedBook = BooksCollection[0];
            }
        }

        private ImageSource GetImgSourceViaUrl(string imgUrl)
        {
            if (!File.Exists(imgUrl))
            {
                return null;
            }
            BitmapImage bmi = new BitmapImage();
            bmi.BeginInit();
            bmi.UriSource = new Uri(imgUrl, UriKind.RelativeOrAbsolute);
            bmi.EndInit();
            if (bmi.CanFreeze)
            {
                bmi.Freeze();
            }
            return bmi;
        }

        public static MainVM GetVMInstance(Window winValue = null, Frame mFrameValue = null, Page mainPageValue = null)
        {
            lock (objLock)
            {
                if (VMInstance == null)
                {
                    VMInstance = new MainVM();
                }
                VMInstance.win = winValue;
                if (VMInstance.win != null)
                {
                    var tempFirstCol = winValue.FindName("firstColumn") as ColumnDefinition;
                    if (tempFirstCol != null)
                    {
                        firstCol = tempFirstCol;
                    }
                    VMInstance.mainFrame = mFrameValue;
                    if (VMInstance.mainFrame != null)
                    {
                        VMInstance.mainFrame.Navigated += MainFrame_Navigated;
                    }
                    VMInstance.mainPage = mainPageValue;
                    if (VMInstance.win != null)
                    {
                        var tempFrame = VMInstance.win.FindName("mainFrame") as Frame;
                        if (tempFrame != null)
                        {
                            VMInstance.mainFrame = tempFrame;
                            VMInstance.mainPage = new MainPageView();
                            VMInstance.mainPage.DataContext = VMInstance;
                            if (VMInstance.mainFrame != null)
                            {
                                VMInstance.mainFrame.Navigate(VMInstance.mainPage);
                            }
                        }
                    }
                }
            }
            return VMInstance;
        }

        private static void MainFrame_Navigated(object sender, NavigationEventArgs e)
        {
            var tempPage = e.Content as System.Windows.Controls.Page;
            if (tempPage != null)
            {
                VMInstance.LbxSelectedIdx = VMInstance.BooksCollection.Select(x=>x.Title).ToList().IndexOf(tempPage.Title);
            }
        }

        private static void Win_Loaded(object sender, RoutedEventArgs e)
        {
            VMInstance?.mainFrame?.Navigate(VMInstance.mainPage);
        }

        private void InitPagesList()
        {
            //mainPage = new MainPageView();
            pagesList.Add(new Page1());
            pagesList.Add(new Page2());
            pagesList.Add(new Page3());
            pagesList.Add(new Page4());
            pagesList.Add(new Page5());
            pagesList.Add(new Page6());
            pagesList.Add(new Page7());
            pagesList.Add(new Page8());
            pagesList.Add(new Page9());
            pagesList.Add(new Page10());
        }

        private void BtnCommandExecuted(object? obj)
        {
            int idx = 0;
            if (Int32.TryParse(obj?.ToString(), out idx))
            {
                mainFrame?.Navigate(pagesList[idx]);
                SelectedBook = BooksCollection[idx + 1];
                SelectedPage = pagesList[idx];
            }
        }

        public event PropertyChangedEventHandler? PropertyChanged;
        public void OnPropertyChanged([CallerMemberName] string propName = "")
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler?.Invoke(this, new PropertyChangedEventArgs(propName));
            }
        }

        private Book selectedBook;
        public Book SelectedBook
        {
            get
            {
                return selectedBook;
            }
            set
            {
                if (value != selectedBook)
                {
                    selectedBook = value;
                    OnPropertyChanged();
                }
            }
        }

        private ObservableCollection<Book> booksCollection;
        public ObservableCollection<Book> BooksCollection
        {
            get
            {
                return booksCollection;
            }
            set
            {
                if (value != booksCollection)
                {
                    booksCollection = value;
                    OnPropertyChanged();
                }
            }
        }

        private object btnContent;
        public object BtnContent
        {
            get
            {
                return btnContent;
            }
            set
            {
                if (value != btnContent)
                {
                    btnContent = value;
                    OnPropertyChanged();
                }
            }
        }

        private Page selectedPage;
        public Page SelectedPage
        {
            get
            {
                return selectedPage;
            }
            set
            {
                if (value != selectedPage)
                {
                    selectedPage = value;
                    OnPropertyChanged(nameof(SelectedPage));
                    OnSelectedPageChanged();
                }
            }
        }

        private void OnSelectedPageChanged()
        {
            if (!pagesList.Contains(SelectedPage))
            {

            }
        }

        private DelCommand btnCommand;
        public DelCommand BtnCommand
        {
            get
            {
                if (btnCommand == null)
                {
                    btnCommand = new DelCommand(BtnCommandExecuted);
                }
                return btnCommand;
            }
        }

        private DelCommand keyDownCommand;
        public DelCommand KeyDownCommand
        {
            get
            {
                if (keyDownCommand == null)
                {
                    keyDownCommand = new DelCommand(KeyDownCommandExecuted);
                }
                return keyDownCommand;
            }
        }

        private void KeyDownCommandExecuted(object? obj)
        {

        }

        private DelCommand lbxSelectionChangedCommand;
        public DelCommand LbxSelectionChangedCommand
        {
            get
            {
                if (lbxSelectionChangedCommand == null)
                {
                    lbxSelectionChangedCommand = new DelCommand(LbxSelectionChangedCommandExecuted);
                }
                return lbxSelectionChangedCommand;
            }
        }

        private void LbxSelectionChangedCommandExecuted(object? obj)
        {
            if (LbxSelectedIdx == 0)
            {
                mainFrame?.Navigate(mainPage);
            }
            else
            {
                mainFrame?.Navigate(pagesList[lbxSelectedIdx - 1]);
            }
        }

        private DelCommand btnToggleCommand;
        public DelCommand BtnToggleCommand
        {
            get
            {
                if (btnToggleCommand == null)
                {
                    btnToggleCommand = new DelCommand(BtnToggleCommandExecuted);
                }
                return btnToggleCommand;
            }
        }

        private void BtnToggleCommandExecuted(object? obj)
        {
            if (BtnContent == "")
            {
                gridLengthAnimation.From = longGridLen;
                gridLengthAnimation.To = shortGridLen;
                firstCol.BeginAnimation(ColumnDefinition.WidthProperty, gridLengthAnimation);
                BtnContent = "";
            }
            else
            {
                gridLengthAnimation.From = shortGridLen;
                gridLengthAnimation.To = longGridLen;
                firstCol.BeginAnimation(ColumnDefinition.WidthProperty, gridLengthAnimation);
                BtnContent = "";
            }
        }

        private int lbxSelectedIdx;
        public int LbxSelectedIdx
        {
            get
            {
                return lbxSelectedIdx;
            }
            set
            {
                if (value != lbxSelectedIdx)
                {
                    lbxSelectedIdx = value;
                    OnPropertyChanged();
                    OnLbxSelectedIdxChanged();
                }
            }
        }

        private void OnLbxSelectedIdxChanged()
        {

        }

        private bool isItemClicked = false;
        public bool IsItemClicked
        {
            get
            {
                return isItemClicked;
            }
            set
            {
                if (value != isItemClicked)
                {
                    isItemClicked = value;
                    OnPropertyChanged();
                }
            }
        }         
    }

    public class Book
    {
        public ImageSource ImgSource { get; set; }
        public string Title { get; set; }
    }

    public class GridLengthAnimation : AnimationTimeline
    {
        public override Type TargetPropertyType => typeof(GridLength);

        protected override Freezable CreateInstanceCore() => new GridLengthAnimation();

        public GridLength From
        {
            get => (GridLength)GetValue(FromProperty);
            set => SetValue(FromProperty, value);
        }

        public static readonly DependencyProperty FromProperty =
            DependencyProperty.Register("From", typeof(GridLength), typeof(GridLengthAnimation));

        public GridLength To
        {
            get => (GridLength)GetValue(ToProperty);
            set => SetValue(ToProperty, value);
        }

        public static readonly DependencyProperty ToProperty =
            DependencyProperty.Register("To", typeof(GridLength), typeof(GridLengthAnimation));

        public override object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)
        {
            double fromVal = From.Value;
            double toVal = To.Value;

            if (fromVal > toVal)
            {
                return new GridLength((1 - animationClock.CurrentProgress.Value) * (fromVal - toVal) + toVal, From.IsStar ? GridUnitType.Star : GridUnitType.Pixel);
            }
            else
            {
                return new GridLength(animationClock.CurrentProgress.Value * (toVal - fromVal) + fromVal, To.IsStar ? GridUnitType.Star : GridUnitType.Pixel);
            }
        }
    }


}


//mainpageview.xaml
<Page x:Class="WpfApp15.Pages.MainPageView"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="MainPageView">
    <Page.Resources>
        <Style TargetType="{x:Type Button}">
            <Setter Property="FontSize" Value="50"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Background="{TemplateBinding Background}"
                         BorderBrush="{TemplateBinding BorderBrush}"
                         BorderThickness="{TemplateBinding BorderThickness}"
                         Padding="{TemplateBinding Padding}">
                            <ContentPresenter HorizontalAlignment="Center"
                                       VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Button Grid.Row="0" Grid.Column="0"
            Content="Page1" 
            Command="{Binding BtnCommand}"
            CommandParameter="0">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/1.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="0" Grid.Column="1"
            Content="Page2" Command="{Binding BtnCommand}"
            CommandParameter="1">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/2.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="0" Grid.Column="2"
            Content="Page3" Command="{Binding BtnCommand}"
            CommandParameter="2">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/3.jpg"/>
            </Button.Background>
        </Button>
        
        <Button Grid.Row="0" Grid.Column="3"
            Content="Page4" Command="{Binding BtnCommand}"
            CommandParameter="3">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/4.jpg"/>
            </Button.Background>
        </Button>
        
        <Button Grid.Row="0" Grid.Column="4"
            Content="Page5" Command="{Binding BtnCommand}"                
            CommandParameter="4">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/5.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="1" Grid.Column="0"
            Content="Page6" Command="{Binding BtnCommand}"                
            CommandParameter="5">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/6.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="1" Grid.Column="1"
            Content="Page7" Command="{Binding BtnCommand}"                
            CommandParameter="6">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/7.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="1" Grid.Column="2"
            Content="Page8" Command="{Binding BtnCommand}"
            CommandParameter="7">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/8.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="1" Grid.Column="3"
            Content="Page9" Command="{Binding BtnCommand}"
            CommandParameter="8">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/9.jpg"/>
            </Button.Background>
        </Button>

        <Button Grid.Row="1" Grid.Column="4"
            Content="Page10" Command="{Binding BtnCommand}"
            CommandParameter="9">
            <Button.Background>
                <ImageBrush ImageSource="pack://application:,,,/Images/10.jpg"/>
            </Button.Background>
        </Button>

    </Grid>    
</Page>


//mainpageview.xaml.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp15.Pages
{
    /// <summary>
    /// Interaction logic for MainPageView.xaml
    /// </summary>
    public partial class MainPageView : Page
    {
        NavigationService ns;
        public MainPageView()
        {
            InitializeComponent();
            //var vm = MainVM.GetVMInstance();
            //this.DataContext = vm;
            //NavigationService nav = NavigationService.GetNavigationService(this);
            ////nav.Navigate(new AnotherPage());
            //this.Loaded += MainPageView_Loaded;            
        }

        private void MainPageView_Loaded(object sender, RoutedEventArgs e)
        {
            ns = this.NavigationService;
            var vm = new MainPageVM(this);
            this.DataContext = vm;
        }
    }

    public class MainPageVM : INotifyPropertyChanged
    {
        private Page mainPage;
        private NavigationService navService;
        public MainPageVM(MainPageView mainPageView)
        {
            mainPage = mainPageView;
            if (mainPage != null)
            {
                mainPage.Loaded += MainPage_Loaded;
            }
            InitCommands();
        }

        private void InitCommands()
        {
            BtnCommand = new DelCommand(BtnCommandExecuted);
        }

        private void BtnCommandExecuted(object? obj)
        {
             
        }

        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {

        }

        public event PropertyChangedEventHandler? PropertyChanged;
        public void OnPropertyChanged([CallerMemberName] string propName = "")
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler?.Invoke(this, new PropertyChangedEventArgs(propName));
            }
        }

        public DelCommand BtnCommand { get; set; }
    }

    public class DelCommand : ICommand
    {
        private Action<object?> execute;
        private Predicate<object?> canExecute;
        public DelCommand(Action<object?> executeValue, Predicate<object?> canExecuteValue = null)
        {
            execute = executeValue;
            canExecute = canExecuteValue;
        }

        public event EventHandler? CanExecuteChanged
        {
            add
            {
                CommandManager.RequerySuggested += value;
            }
            remove
            {
                CommandManager.RequerySuggested -= value;
            }
        }

        public bool CanExecute(object? parameter)
        {
            return canExecute == null ? true : canExecute(parameter);
        }

        public void Execute(object? parameter)
        {
            execute(parameter);
        }
    }
}



//page1.xaml
<Page x:Class="WpfApp15.Pages.Page1"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page1">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/1.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>


//page2.xaml
<Page x:Class="WpfApp15.Pages.Page2"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page2">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/2.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>


//page3.xaml
<Page x:Class="WpfApp15.Pages.Page3"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page3">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/3.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>


//page4.xaml
<Page x:Class="WpfApp15.Pages.Page4"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page4">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/4.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>



//page5.xaml
<Page x:Class="WpfApp15.Pages.Page5"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page5">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/5.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>



//page6.xaml
<Page x:Class="WpfApp15.Pages.Page6"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page6">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/6.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>


//page7.xaml
<Page x:Class="WpfApp15.Pages.Page7"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page7">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/7.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>



//page8.xaml
<Page x:Class="WpfApp15.Pages.Page8"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page8">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/8.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>


//page9.xaml
<Page x:Class="WpfApp15.Pages.Page9"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page9">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/9.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>


//page10.xaml
<Page x:Class="WpfApp15.Pages.Page10"
      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" 
      xmlns:local="clr-namespace:WpfApp15.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" d:DesignWidth="800"
      Title="Page10">

    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/10.jpg" Stretch="Uniform"/>
        </Grid.Background>
    </Grid>
</Page>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2025-05-18 17:04  FredGrit  阅读(4)  评论(0)    收藏  举报