/
EugenyCh7
/
AvaloniaRoutingExample
Обзор
Документация
Войти
/
EugenyCh7
/
AvaloniaRoutingExample
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
RoutingExample/Views/MainWindow.axaml
43 строки
2 KB
Eugeny Chekmarev
Реализована маршрутизация
23 янв 2025, 18:13
23 янв 2025, 18:13
bfdb449
Код
Авторство
О чём код?
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="using:RoutingExample.ViewModels" xmlns:rxui="http://reactiveui.net" xmlns:app="clr-namespace:RoutingExample" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="RoutingExample.Views.MainWindow" x:DataType="vm:MainWindowViewModel" Icon="/Assets/avalonia-logo.ico" Title="RoutingExample"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <rxui:RoutedViewHost Grid.Row="0" Router="{Binding Router}"> <rxui:RoutedViewHost.DefaultContent> <TextBlock Text="Default content" HorizontalAlignment="Center" VerticalAlignment="Center" /> </rxui:RoutedViewHost.DefaultContent> <rxui:RoutedViewHost.ViewLocator> <!-- See AppViewLocator.cs section below --> <app:AppViewLocator /> </rxui:RoutedViewHost.ViewLocator> </rxui:RoutedViewHost> <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="15"> <StackPanel.Styles> <Style Selector="StackPanel > :is(Control)"> <Setter Property="Margin" Value="2"/> </Style> <Style Selector="StackPanel > TextBlock"> <Setter Property="VerticalAlignment" Value="Center"/> </Style> </StackPanel.Styles> <Button Content="Go next" Command="{Binding GoNext}" /> <Button Content="Go back" Command="{Binding GoBack}" /> <TextBlock Text="{Binding Router.NavigationStack.Count}" /> </StackPanel> </Grid> </Window>