Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit fce3756

Browse files
authored
Merge pull request #67 from AvaloniaInside/develop
v1.3.0
2 parents d0d88d9 + 24e0312 commit fce3756

76 files changed

Lines changed: 1992 additions & 904 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/dotnet.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# This workflow will build a .NET project
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
33

4-
name: .NET
4+
name: CI
55

66
on:
77
push:
8-
branches: [ "main" ]
8+
branches: [ "main", "develop" ]
99
pull_request:
10-
branches: [ "main" ]
10+
branches: [ "main", "develop" ]
1111

1212
jobs:
1313
build:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ We welcome feedback, suggestions, and contributions from anyone who is intereste
2121
To use AvaloniaInside.Shell in your Avalonia project, you can install the package via NuGet using the following command in the Package Manager Console:
2222

2323
```bash
24-
dotnet add package AvaloniaInside.Shell --version 1.2.0
24+
dotnet add package AvaloniaInside.Shell --version 1.3.0
2525
```
2626

2727
Alternatively, you can also install the package through Visual Studio's NuGet Package Manager.

src/AvaloniaInside.Shell/AppBuilderExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace AvaloniaInside.Shell;
88
public static class AppBuilderExtensions
99
{
1010
public static AppBuilder UseShell(this AppBuilder builder, Func<INavigationViewLocator>? viewLocatorFactory = null) =>
11-
builder.AfterPlatformServicesSetup(_ =>
11+
builder.AfterPlatformServicesSetup(_ => Locator.RegisterResolverCallbackChanged(() =>
1212
{
1313
if (Locator.CurrentMutable is null)
1414
{
@@ -37,7 +37,7 @@ public static AppBuilder UseShell(this AppBuilder builder, Func<INavigationViewL
3737
viewLocator
3838
);
3939
});
40-
});
40+
}));
4141

4242
public static AppBuilder UseShell(this AppBuilder builder, Func<NavigationNode, object> viewFactory)
4343
=> builder.UseShell(() => new DelegateNavigationViewLocator(viewFactory));

src/AvaloniaInside.Shell/AvaloniaInside.Shell.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
44
<Nullable>enable</Nullable>
55
<LangVersion>latest</LangVersion>
6-
<Version>1.2.0</Version>
6+
<Version>1.3.0</Version>
77
<Title>Shell view for Avalonia</Title>
88
<Description>Shell reduces the complexity of mobile/desktop application development by providing the fundamental features that most applications require</Description>
99
<Copyright>AvaloniaInside</Copyright>
@@ -19,14 +19,14 @@
1919
</PropertyGroup>
2020
<ItemGroup>
2121
<AvaloniaResource Include="Assets\**" />
22+
<AvaloniaResource Include="**\*.axaml" />
2223
</ItemGroup>
2324
<ItemGroup>
2425
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
2526
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
2627
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
2728
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
2829
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
29-
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
3030
</ItemGroup>
3131
<ItemGroup>
3232
<UpToDateCheckInput Remove="Assets\avalonia-logo.ico" />

src/AvaloniaInside.Shell/BindingNavigate.cs

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,65 +7,64 @@
77
using System.Threading.Tasks;
88
using System.Windows.Input;
99

10-
namespace AvaloniaInside.Shell
10+
namespace AvaloniaInside.Shell;
11+
12+
[TypeConverter(typeof(BindingNavigateConverter))]
13+
public class BindingNavigate : AvaloniaObject, ICommand
1114
{
12-
[TypeConverter(typeof(BindingNavigateConverter))]
13-
public class BindingNavigate : AvaloniaObject, ICommand
14-
{
15-
private bool _singletonCanExecute = true;
16-
private EventHandler? _singletonCanExecuteChanged;
15+
private bool _singletonCanExecute = true;
16+
private EventHandler? _singletonCanExecuteChanged;
1717

18-
public AvaloniaObject? Sender { get; internal set; }
19-
public string Path { get; set; }
20-
public NavigateType? Type { get; set; }
21-
public IPageTransition? Transition { get; set; }
18+
public AvaloniaObject? Sender { get; internal set; }
19+
public string Path { get; set; }
20+
public NavigateType? Type { get; set; }
21+
public IPageTransition? Transition { get; set; }
2222

23-
public event EventHandler? CanExecuteChanged
24-
{
25-
add => _singletonCanExecuteChanged += value;
26-
remove => _singletonCanExecuteChanged -= value;
27-
}
23+
public event EventHandler? CanExecuteChanged
24+
{
25+
add => _singletonCanExecuteChanged += value;
26+
remove => _singletonCanExecuteChanged -= value;
27+
}
2828

29-
public bool CanExecute(object? parameter) => _singletonCanExecute;
30-
public void Execute(object? parameter) => ExecuteAsync(parameter, CancellationToken.None);
29+
public bool CanExecute(object? parameter) => _singletonCanExecute;
30+
public void Execute(object? parameter) => ExecuteAsync(parameter, CancellationToken.None);
3131

32-
public async Task ExecuteAsync(object? parameter, CancellationToken cancellationToken)
33-
{
34-
if (Sender is not Visual visual) return;
35-
if (visual.FindAncestorOfType<ShellView>() is not { } shell) return;
32+
public async Task ExecuteAsync(object? parameter, CancellationToken cancellationToken)
33+
{
34+
if (Sender is not Visual visual) return;
35+
if (visual.FindAncestorOfType<ShellView>() is not { } shell) return;
3636

37-
_singletonCanExecute = false;
38-
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
39-
try
40-
{
41-
if (parameter != null)
42-
await shell.Navigator.NavigateAsync(
43-
Path,
44-
Type,
45-
parameter,
46-
Sender,
47-
true,
48-
Transition,
49-
cancellationToken);
50-
else
51-
await shell.Navigator.NavigateAsync(
52-
Path,
53-
Type,
54-
Sender,
55-
true,
56-
Transition,
57-
cancellationToken);
58-
}
59-
finally
60-
{
61-
_singletonCanExecute = true;
62-
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
63-
}
37+
_singletonCanExecute = false;
38+
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
39+
try
40+
{
41+
if (parameter != null)
42+
await shell.Navigator.NavigateAsync(
43+
Path,
44+
Type,
45+
parameter,
46+
Sender,
47+
true,
48+
Transition,
49+
cancellationToken);
50+
else
51+
await shell.Navigator.NavigateAsync(
52+
Path,
53+
Type,
54+
Sender,
55+
true,
56+
Transition,
57+
cancellationToken);
6458
}
65-
66-
public static implicit operator BindingNavigate(string path) => new BindingNavigate
59+
finally
6760
{
68-
Path = path
69-
};
61+
_singletonCanExecute = true;
62+
_singletonCanExecuteChanged?.Invoke(this, EventArgs.Empty);
63+
}
7064
}
65+
66+
public static implicit operator BindingNavigate(string path) => new BindingNavigate
67+
{
68+
Path = path
69+
};
7170
}

src/AvaloniaInside.Shell/BindingNavigateConverter.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Avalonia.Media;
2-
using System;
1+
using System;
32
using System.ComponentModel;
43
using System.Globalization;
54

src/AvaloniaInside.Shell/Default.axaml

Lines changed: 4 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -3,192 +3,11 @@
33

44
<Styles.Resources>
55
<ResourceDictionary>
6-
<ResourceDictionary.ThemeDictionaries>
7-
<ResourceDictionary x:Key='Light'>
8-
<SolidColorBrush x:Key='AppBackground' Color="{OnPlatform White, iOS=Black}"></SolidColorBrush>
9-
<SolidColorBrush x:Key='PageBackground'>White</SolidColorBrush>
10-
</ResourceDictionary>
11-
<ResourceDictionary x:Key='Dark'>
12-
<SolidColorBrush x:Key='AppBackground'>Black</SolidColorBrush>
13-
<SolidColorBrush x:Key='PageBackground'>Black</SolidColorBrush>
14-
</ResourceDictionary>
15-
</ResourceDictionary.ThemeDictionaries>
6+
<ResourceDictionary.MergedDictionaries>
7+
<ResourceInclude Source="Theme/Default/Colors.axaml"></ResourceInclude>
8+
</ResourceDictionary.MergedDictionaries>
169
</ResourceDictionary>
1710
</Styles.Resources>
1811

19-
<Style Selector="NavigationBar">
20-
<Setter Property="Template">
21-
<ControlTemplate TargetType="NavigationBar">
22-
<Border Background="{TemplateBinding Background}"
23-
Padding="{TemplateBinding Padding}"
24-
Margin="{TemplateBinding Margin}"
25-
MinHeight="35">
26-
<Grid RowDefinitions="Auto,*">
27-
<Border Grid.Row="0"
28-
Height="{TemplateBinding TopSafeSpace}"
29-
IsVisible="{TemplateBinding ApplyTopSafePadding}"></Border>
30-
<Button Name="PART_ActionButton"
31-
HorizontalAlignment="Left"
32-
VerticalAlignment="Center"
33-
HorizontalContentAlignment="Center"
34-
VerticalContentAlignment="Center"
35-
Width="35"
36-
Grid.Row="1">
37-
</Button>
38-
<TransitioningContentControl Grid.Row="1" Name="PART_Header" HorizontalAlignment="Center" VerticalAlignment="Center" />
39-
<TransitioningContentControl Grid.Row="1" Name="PART_Items" HorizontalAlignment="Right" VerticalAlignment="Center" />
40-
</Grid>
41-
</Border>
42-
</ControlTemplate>
43-
</Setter>
44-
</Style>
45-
46-
<Style Selector="ShellView">
47-
<Setter Property="Template">
48-
<ControlTemplate>
49-
<Panel Background="{TemplateBinding Background}">
50-
<SplitView Name="PART_SplitView" DisplayMode="Inline">
51-
<SplitView.Pane>
52-
<SideMenu Name="PART_SideMenu"
53-
SelectedItem="{TemplateBinding SideMenuSelectedItem, Mode=TwoWay}"
54-
Header="{TemplateBinding SideMenuHeader}"
55-
Footer="{TemplateBinding SideMenuFooter}"
56-
Contents="{TemplateBinding SideMenuContents}"
57-
ContentsTemplate="{TemplateBinding SideMenuContentsTemplate}">
58-
</SideMenu>
59-
</SplitView.Pane>
60-
61-
<Grid RowDefinitions="Auto,*,Auto">
62-
<NavigationBar Name="PART_NavigationBar"
63-
TopSafePadding="{TemplateBinding TopSafePadding}"
64-
TopSafeSpace="{TemplateBinding TopSafeSpace}"
65-
ApplyTopSafePadding="{TemplateBinding ApplyTopSafePadding}"/>
66-
<StackContentView Name="PART_ContentView"
67-
Grid.Row="1"
68-
PageTransition="{TemplateBinding DefaultPageTransition}"></StackContentView>
69-
<Border Grid.Row="2"
70-
IsVisible="{TemplateBinding ApplyBottomSafePadding}"
71-
Height="{TemplateBinding BottomSafeSpace}">
72-
<Border.Styles>
73-
<Style Selector="Border[IsVisible=True]">
74-
<Setter Property="RenderTransform" Value="scaleY(1)"></Setter>
75-
</Style>
76-
<Style Selector="Border[IsVisible=False]">
77-
<Setter Property="RenderTransform" Value="scaleY(0)"></Setter>
78-
</Style>
79-
</Border.Styles>
80-
</Border>
81-
</Grid>
82-
</SplitView>
83-
84-
<Rectangle IsVisible="{Binding ElementName=PART_Modal, Path=HasContent}"
85-
Opacity="0.5">
86-
<Rectangle.Fill>
87-
<VisualBrush
88-
TileMode="Tile"
89-
SourceRect="0,0,8,8"
90-
DestinationRect="0,0,8,8"
91-
Stretch="UniformToFill">
92-
<VisualBrush.Visual>
93-
<Canvas Width="8" Height="8">
94-
<Rectangle Fill="Black" Width="8" Height="8"></Rectangle>
95-
<Line StartPoint="0,0" EndPoint="8,8" Stroke="#55555555" StrokeThickness="1" />
96-
<Line StartPoint="0,8" EndPoint="8,0" Stroke="#55555555" StrokeThickness="1" />
97-
</Canvas>
98-
</VisualBrush.Visual>
99-
</VisualBrush>
100-
</Rectangle.Fill>
101-
</Rectangle>
102-
103-
<StackContentView Name="PART_Modal"
104-
IsVisible="{Binding ElementName=PART_Modal, Path=HasContent}"
105-
PageTransition="{TemplateBinding ModalPageTransition}">
106-
</StackContentView>
107-
</Panel>
108-
</ControlTemplate>
109-
</Setter>
110-
<Setter Property="SideMenuContentsTemplate">
111-
<DataTemplate>
112-
<ContentPresenter Content="{Binding .}"></ContentPresenter>
113-
</DataTemplate>
114-
</Setter>
115-
</Style>
116-
117-
<Style Selector="SideMenu">
118-
<Setter Property="Template">
119-
<ControlTemplate>
120-
<Grid RowDefinitions="Auto,*,Auto">
121-
<ContentPresenter Name="PART_Header"
122-
ContentTemplate="{TemplateBinding HeaderTemplate}"
123-
Content="{TemplateBinding Header}"></ContentPresenter>
124-
<ScrollViewer Grid.Row="1">
125-
<StackPanel Orientation="Vertical">
126-
<ListBox Name="PART_Items"
127-
ItemsSource="{TemplateBinding Items}"
128-
SelectedItem="{TemplateBinding SelectedItem, Mode=TwoWay}">
129-
<ListBox.ItemsPanel>
130-
<ItemsPanelTemplate>
131-
<StackPanel></StackPanel>
132-
</ItemsPanelTemplate>
133-
</ListBox.ItemsPanel>
134-
<ListBox.ItemTemplate>
135-
<DataTemplate>
136-
<StackPanel Orientation="Horizontal" Height="22" Spacing="8">
137-
<Image Source="{Binding Icon}"
138-
IsVisible="{Binding !!Icon}"
139-
VerticalAlignment="Center"></Image>
140-
<TextBlock Text="{Binding Title}"
141-
VerticalAlignment="Center"></TextBlock>
142-
</StackPanel>
143-
</DataTemplate>
144-
</ListBox.ItemTemplate>
145-
</ListBox>
146-
<ItemsControl Name="PART_Contents"
147-
ItemsSource="{TemplateBinding Contents}"
148-
ItemTemplate="{TemplateBinding ContentsTemplate}" />
149-
</StackPanel>
150-
</ScrollViewer>
151-
<ContentPresenter Grid.Row="2"
152-
Name="PART_Footer"
153-
ContentTemplate="{TemplateBinding FooterTemplate}"
154-
Content="{TemplateBinding Footer}"></ContentPresenter>
155-
</Grid>
156-
</ControlTemplate>
157-
</Setter>
158-
</Style>
159-
160-
<Style Selector="Button.BackButton">
161-
<Setter Property="Template">
162-
<ControlTemplate>
163-
<Viewbox Stretch="UniformToFill">
164-
<Canvas Width="16" Height="16" Margin="5" Background="#00000000">
165-
<Line StartPoint="7,2" EndPoint="2,8" StrokeThickness="3" Stroke="{DynamicResource ButtonForeground}"></Line>
166-
<Line StartPoint="2,6" EndPoint="7,12" StrokeThickness="3" Stroke="{DynamicResource ButtonForeground}"></Line>
167-
</Canvas>
168-
</Viewbox>
169-
</ControlTemplate>
170-
</Setter>
171-
</Style>
172-
<Style Selector="Button.SideMenuButton">
173-
<Setter Property="RenderTransform" Value="rotate(180deg)" />
174-
<Setter Property="Template">
175-
<ControlTemplate>
176-
<Viewbox Stretch="UniformToFill">
177-
<Canvas Width="16" Height="16" Margin="5" Background="#00000000">
178-
<Line StartPoint="1,4" EndPoint="15,4" StrokeThickness="3" Stroke="{DynamicResource ButtonForeground}"></Line>
179-
<Line StartPoint="1,8" EndPoint="15,8" StrokeThickness="3" Stroke="{DynamicResource ButtonForeground}"></Line>
180-
<Line StartPoint="1,12" EndPoint="15,12" StrokeThickness="3" Stroke="{DynamicResource ButtonForeground}"></Line>
181-
</Canvas>
182-
</Viewbox>
183-
</ControlTemplate>
184-
</Setter>
185-
</Style>
186-
187-
<Style Selector="Page">
188-
<Setter Property="Background" Value="{DynamicResource PageBackground}" />
189-
</Style>
190-
191-
<Style Selector="ShellView">
192-
<Setter Property="Background" Value="{DynamicResource AppBackground}" />
193-
</Style>
12+
<StyleInclude Source="/Theme/Default/Controls.axaml" />
19413
</Styles>

0 commit comments

Comments
 (0)