diff --git a/Avalonia.sln b/Avalonia.sln
index fe4796539e..ab022eedf2 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -236,7 +236,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Web.Blazor", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.Web", "samples\ControlCatalog.Web\ControlCatalog.Web.csproj", "{C08E9894-AA92-426E-BF56-033E262CAD3E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsInteropTest", "samples\interop\WindowsInteropTest\WindowsInteropTest.csproj", "{26A98DA1-D89D-4A95-8152-349F404DA2E2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsInteropTest", "samples\interop\WindowsInteropTest\WindowsInteropTest.csproj", "{26A98DA1-D89D-4A95-8152-349F404DA2E2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlSamples", "samples\SampleControls\ControlSamples.csproj", "{A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -2172,6 +2174,30 @@ Global
{26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhone.Build.0 = Release|Any CPU
{26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|Any CPU.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhone.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhone.Build.0 = Release|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2235,6 +2261,7 @@ Global
{25831348-EB2A-483E-9576-E8F6528674A5} = {86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}
{C08E9894-AA92-426E-BF56-033E262CAD3E} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{26A98DA1-D89D-4A95-8152-349F404DA2E2} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
+ {A0D0A6A4-5C72-4ADA-9B27-621C7D94F270} = {9B9E3891-2366-4253-A952-D08BCEB71098}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A}
diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml
index 6e57686e00..227b31bf20 100644
--- a/samples/ControlCatalog/App.xaml
+++ b/samples/ControlCatalog/App.xaml
@@ -5,6 +5,9 @@
x:CompileBindings="True"
x:Class="ControlCatalog.App">
+
-
+
diff --git a/samples/ControlCatalog/ControlCatalog.csproj b/samples/ControlCatalog/ControlCatalog.csproj
index 53ad213d92..7864459e77 100644
--- a/samples/ControlCatalog/ControlCatalog.csproj
+++ b/samples/ControlCatalog/ControlCatalog.csproj
@@ -26,6 +26,7 @@
+
diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml
index f61b59e6cd..3d869bb723 100644
--- a/samples/ControlCatalog/MainView.xaml
+++ b/samples/ControlCatalog/MainView.xaml
@@ -1,108 +1,195 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
-
-
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
-
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled">
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No Decorations
- Border Only
- Full Decorations
-
-
- Fluent - Light
- Fluent - Dark
- Simple - Light
- Simple - Dark
-
-
- None
- Transparent
- Blur
- AcrylicBlur
- Mica
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ None
+ BorderOnly
+ Full
+
+
+
+
+ FluentLight
+ FluentDark
+ DefaultLight
+ DefaultDark
+
+
+
+
+ None
+ Transparent
+ Blur
+ AcrylicBlur
+ Mica
+
+
+
+
+
+
+
diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs
index c84f2f06b6..abedda3c85 100644
--- a/samples/ControlCatalog/MainView.xaml.cs
+++ b/samples/ControlCatalog/MainView.xaml.cs
@@ -6,8 +6,11 @@ using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.MarkupExtensions;
using Avalonia.Markup.Xaml.Styling;
using Avalonia.Markup.Xaml.XamlIl;
+using Avalonia.Media;
+using Avalonia.Media.Immutable;
using Avalonia.Platform;
using ControlCatalog.Pages;
+using ControlCatalog.Models;
namespace ControlCatalog
{
@@ -16,9 +19,12 @@ namespace ControlCatalog
public MainView()
{
AvaloniaXamlLoader.Load(this);
+
+ var sideBar = this.FindControl("Sidebar");
+
if (AvaloniaLocator.Current.GetService().GetRuntimeInfo().IsDesktop)
{
- IList tabItems = ((IList)this.FindControl("Sidebar").Items);
+ IList tabItems = ((IList)sideBar.Items);
tabItems.Add(new TabItem()
{
Header = "Dialogs",
@@ -35,28 +41,42 @@ namespace ControlCatalog
var themes = this.Find("Themes");
themes.SelectionChanged += (sender, e) =>
{
- switch (themes.SelectedIndex)
+ if (themes.SelectedItem is CatalogTheme theme)
{
- case 0:
- Application.Current.Styles[0] = App.FluentLight;
- break;
- case 1:
- Application.Current.Styles[0] = App.FluentDark;
- break;
- case 2:
- Application.Current.Styles[0] = App.DefaultLight;
- break;
- case 3:
- Application.Current.Styles[0] = App.DefaultDark;
- break;
+ Application.Current.Styles[0] = theme switch
+ {
+ CatalogTheme.FluentLight => App.FluentLight,
+ CatalogTheme.FluentDark => App.FluentDark,
+ CatalogTheme.DefaultLight => App.DefaultLight,
+ CatalogTheme.DefaultDark => App.DefaultDark,
+ _ => Application.Current.Styles[0]
+ };
}
- };
+ };
var decorations = this.Find("Decorations");
decorations.SelectionChanged += (sender, e) =>
{
- if (VisualRoot is Window window)
- window.SystemDecorations = (SystemDecorations)decorations.SelectedIndex;
+ if (VisualRoot is Window window
+ && decorations.SelectedItem is SystemDecorations systemDecorations)
+ {
+ window.SystemDecorations = systemDecorations;
+ }
+ };
+
+ var transparencyLevels = this.Find("TransparencyLevels");
+ IDisposable backgroundSetter = null, paneBackgroundSetter = null;
+ transparencyLevels.SelectionChanged += (sender, e) =>
+ {
+ backgroundSetter?.Dispose();
+ paneBackgroundSetter?.Dispose();
+ if (transparencyLevels.SelectedItem is WindowTransparencyLevel selected
+ && selected != WindowTransparencyLevel.None)
+ {
+ var semiTransparentBrush = new ImmutableSolidColorBrush(Colors.Gray, 0.5);
+ backgroundSetter = sideBar.SetValue(BackgroundProperty, semiTransparentBrush, Avalonia.Data.BindingPriority.Style);
+ paneBackgroundSetter = sideBar.SetValue(SplitView.PaneBackgroundProperty, semiTransparentBrush, Avalonia.Data.BindingPriority.Style);
+ }
};
}
diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml
index 375345f64e..1e4bf2de38 100644
--- a/samples/ControlCatalog/MainWindow.xaml
+++ b/samples/ControlCatalog/MainWindow.xaml
@@ -61,17 +61,7 @@
-
-
-
-
+
diff --git a/samples/ControlCatalog/MainWindow.xaml.cs b/samples/ControlCatalog/MainWindow.xaml.cs
index a9900471c5..dd62698cc7 100644
--- a/samples/ControlCatalog/MainWindow.xaml.cs
+++ b/samples/ControlCatalog/MainWindow.xaml.cs
@@ -33,9 +33,6 @@ namespace ControlCatalog
DataContext = new MainWindowViewModel(_notificationArea);
_recentMenu = ((NativeMenu.GetMenu(this).Items[0] as NativeMenuItem).Menu.Items[2] as NativeMenuItem).Menu;
- var mainMenu = this.FindControl
diff --git a/samples/ControlCatalog/Pages/ExpanderPage.xaml b/samples/ControlCatalog/Pages/ExpanderPage.xaml
index 605eff4fce..cef473af04 100644
--- a/samples/ControlCatalog/Pages/ExpanderPage.xaml
+++ b/samples/ControlCatalog/Pages/ExpanderPage.xaml
@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ControlCatalog.Pages.ExpanderPage">
- Expander
Expands to show nested content
- Image
Displays an image
diff --git a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml
index 4d0bd663df..8305d72d1f 100644
--- a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml
+++ b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml
@@ -43,7 +43,6 @@
- ItemsRepeater
A data-driven collection control that incorporates a flexible layout system, custom views, and virtualization.
diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml b/samples/ControlCatalog/Pages/ListBoxPage.xaml
index b36629fb2a..41658329df 100644
--- a/samples/ControlCatalog/Pages/ListBoxPage.xaml
+++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml
@@ -13,7 +13,6 @@
- ListBox
Hosts a collection of ListBoxItem.
Each 5th item is highlighted with nth-child(5n+3) and nth-last-child(5n+4) rules.
diff --git a/samples/ControlCatalog/Pages/MenuPage.xaml b/samples/ControlCatalog/Pages/MenuPage.xaml
index 2c09cb9b4d..0e5b49914f 100644
--- a/samples/ControlCatalog/Pages/MenuPage.xaml
+++ b/samples/ControlCatalog/Pages/MenuPage.xaml
@@ -2,16 +2,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ControlCatalog.Pages.MenuPage">
- Menu
Exported menu fallback
(Should be only visible on platforms without desktop-global menu bar)
A window menu
-
+
Defined in XAML
-
+
diff --git a/samples/ControlCatalog/Pages/NotificationsPage.xaml b/samples/ControlCatalog/Pages/NotificationsPage.xaml
index 94e2314dc7..d48b338fe8 100644
--- a/samples/ControlCatalog/Pages/NotificationsPage.xaml
+++ b/samples/ControlCatalog/Pages/NotificationsPage.xaml
@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ControlCatalog.Pages.NotificationsPage">
- Notifications
diff --git a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml
index d75622f1fb..fd46b9d5ed 100644
--- a/samples/ControlCatalog/Pages/NumericUpDownPage.xaml
+++ b/samples/ControlCatalog/Pages/NumericUpDownPage.xaml
@@ -7,8 +7,8 @@
Numeric up-down control provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel.
Features:
-
-
+
+
ShowButtonSpinner:
@@ -22,7 +22,7 @@
-
+
FormatString:
@@ -51,7 +51,7 @@
Text:
-
+
Minimum:
@@ -69,7 +69,7 @@
Margin="2" HorizontalAlignment="Center"/>
-
+
Usage of NumericUpDown:
diff --git a/samples/ControlCatalog/Pages/ProgressBarPage.xaml b/samples/ControlCatalog/Pages/ProgressBarPage.xaml
index da8ef6cf07..db7d7d3280 100644
--- a/samples/ControlCatalog/Pages/ProgressBarPage.xaml
+++ b/samples/ControlCatalog/Pages/ProgressBarPage.xaml
@@ -1,6 +1,5 @@
- ProgressBar
A progress bar control
diff --git a/samples/ControlCatalog/Pages/RadioButtonPage.xaml b/samples/ControlCatalog/Pages/RadioButtonPage.xaml
index 408f9c2411..8623d81b3f 100644
--- a/samples/ControlCatalog/Pages/RadioButtonPage.xaml
+++ b/samples/ControlCatalog/Pages/RadioButtonPage.xaml
@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ControlCatalog.Pages.RadioButtonPage">
- RadioButton
Allows the selection of a single option of many
+
@@ -57,4 +59,5 @@
+
diff --git a/samples/ControlCatalog/Pages/ScrollViewerPage.xaml b/samples/ControlCatalog/Pages/ScrollViewerPage.xaml
index bbefcab9ca..1b3771ccb5 100644
--- a/samples/ControlCatalog/Pages/ScrollViewerPage.xaml
+++ b/samples/ControlCatalog/Pages/ScrollViewerPage.xaml
@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ControlCatalog.Pages.ScrollViewerPage">
- ScrollViewer
Allows for horizontal and vertical content scrolling.
diff --git a/samples/ControlCatalog/Pages/SliderPage.xaml b/samples/ControlCatalog/Pages/SliderPage.xaml
index b4901ec780..b2375922c2 100644
--- a/samples/ControlCatalog/Pages/SliderPage.xaml
+++ b/samples/ControlCatalog/Pages/SliderPage.xaml
@@ -3,7 +3,6 @@
xmlns:sys="clr-namespace:System;assembly=netstandard"
x:Class="ControlCatalog.Pages.SliderPage">
- Slider
A control that lets the user select from a range of values by moving a Thumb control along a Track.
diff --git a/samples/ControlCatalog/Pages/TabControlPage.xaml b/samples/ControlCatalog/Pages/TabControlPage.xaml
index e700146a5b..cba6fcd0ad 100644
--- a/samples/ControlCatalog/Pages/TabControlPage.xaml
+++ b/samples/ControlCatalog/Pages/TabControlPage.xaml
@@ -3,12 +3,6 @@
x:Class="ControlCatalog.Pages.TabControlPage"
xmlns="https://github.com/avaloniaui">
-
-
- TabStrip
A control which displays a selectable strip of tabs
diff --git a/samples/ControlCatalog/Pages/TextBlockPage.xaml b/samples/ControlCatalog/Pages/TextBlockPage.xaml
index d4f72f161a..9998a20d42 100644
--- a/samples/ControlCatalog/Pages/TextBlockPage.xaml
+++ b/samples/ControlCatalog/Pages/TextBlockPage.xaml
@@ -1,102 +1,99 @@
-
+
- TextBlock
A control that can display text
-
-
+
+
-
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
@@ -107,19 +104,19 @@
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
+
diff --git a/samples/ControlCatalog/Pages/TextBoxPage.xaml b/samples/ControlCatalog/Pages/TextBoxPage.xaml
index 0a5ccdcfff..f15ac8ffd6 100644
--- a/samples/ControlCatalog/Pages/TextBoxPage.xaml
+++ b/samples/ControlCatalog/Pages/TextBoxPage.xaml
@@ -3,14 +3,11 @@
x:Class="ControlCatalog.Pages.TextBoxPage"
xmlns:sys="clr-namespace:System;assembly=netstandard">
-
-
-
+
+
@@ -21,7 +18,7 @@
-
+
+
+
+
+
+
+
+ FontFamily="Comic Sans MS"
+ FontSize="10"
+ Foreground="Red"/>
-
-
-
-
-
-
-
-
+
@@ -78,14 +74,14 @@
-
+
-
+
diff --git a/samples/ControlCatalog/Pages/ToggleSwitchPage.xaml b/samples/ControlCatalog/Pages/ToggleSwitchPage.xaml
index 7a65275a8e..4db755b6fc 100644
--- a/samples/ControlCatalog/Pages/ToggleSwitchPage.xaml
+++ b/samples/ControlCatalog/Pages/ToggleSwitchPage.xaml
@@ -1,7 +1,8 @@
-
+
diff --git a/samples/ControlCatalog/Pages/ToolTipPage.xaml b/samples/ControlCatalog/Pages/ToolTipPage.xaml
index de23c7a169..013c176bca 100644
--- a/samples/ControlCatalog/Pages/ToolTipPage.xaml
+++ b/samples/ControlCatalog/Pages/ToolTipPage.xaml
@@ -3,7 +3,6 @@
x:Class="ControlCatalog.Pages.ToolTipPage">
- ToolTip
A control which pops up a hint when a control is hovered
- TreeView
Displays a hierachical tree of data.
- Viewbox
A control used to scale single child.
diff --git a/samples/ControlCatalog/SideBar.xaml b/samples/ControlCatalog/SideBar.xaml
deleted file mode 100644
index 2b5215a3fe..0000000000
--- a/samples/ControlCatalog/SideBar.xaml
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/samples/RenderDemo/App.xaml b/samples/RenderDemo/App.xaml
index 7cdcea2e1d..66d97a6444 100644
--- a/samples/RenderDemo/App.xaml
+++ b/samples/RenderDemo/App.xaml
@@ -1,9 +1,8 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/samples/RenderDemo/MainWindow.xaml b/samples/RenderDemo/MainWindow.xaml
index f37df56b73..a4c6299278 100644
--- a/samples/RenderDemo/MainWindow.xaml
+++ b/samples/RenderDemo/MainWindow.xaml
@@ -1,68 +1,67 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj
index eed6fa9e89..54d5ca4b3b 100644
--- a/samples/RenderDemo/RenderDemo.csproj
+++ b/samples/RenderDemo/RenderDemo.csproj
@@ -10,6 +10,7 @@
+
diff --git a/samples/RenderDemo/SideBar.xaml b/samples/RenderDemo/SideBar.xaml
deleted file mode 100644
index b82a7b0514..0000000000
--- a/samples/RenderDemo/SideBar.xaml
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/samples/SampleControls/ControlSamples.csproj b/samples/SampleControls/ControlSamples.csproj
new file mode 100644
index 0000000000..6eaf11a0fc
--- /dev/null
+++ b/samples/SampleControls/ControlSamples.csproj
@@ -0,0 +1,23 @@
+
+
+
+ netstandard2.0
+ enable
+
+
+
+
+ %(Filename)
+
+
+ Designer
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/SampleControls/HamburgerMenu/HamburgerMenu.cs b/samples/SampleControls/HamburgerMenu/HamburgerMenu.cs
new file mode 100644
index 0000000000..bbfd3d87ca
--- /dev/null
+++ b/samples/SampleControls/HamburgerMenu/HamburgerMenu.cs
@@ -0,0 +1,77 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Media;
+
+namespace ControlSamples
+{
+ public class HamburgerMenu : TabControl
+ {
+ private SplitView? _splitView;
+
+ public static readonly StyledProperty PaneBackgroundProperty =
+ SplitView.PaneBackgroundProperty.AddOwner();
+
+ public IBrush? PaneBackground
+ {
+ get => GetValue(PaneBackgroundProperty);
+ set => SetValue(PaneBackgroundProperty, value);
+ }
+
+ public static readonly StyledProperty ContentBackgroundProperty =
+ AvaloniaProperty.Register(nameof(ContentBackground));
+
+ public IBrush? ContentBackground
+ {
+ get => GetValue(ContentBackgroundProperty);
+ set => SetValue(ContentBackgroundProperty, value);
+ }
+
+ public static readonly StyledProperty ExpandedModeThresholdWidthProperty =
+ AvaloniaProperty.Register(nameof(ExpandedModeThresholdWidth), 1008);
+
+ public int ExpandedModeThresholdWidth
+ {
+ get => GetValue(ExpandedModeThresholdWidthProperty);
+ set => SetValue(ExpandedModeThresholdWidthProperty, value);
+ }
+
+ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
+ {
+ base.OnApplyTemplate(e);
+
+ _splitView = e.NameScope.Find("PART_NavigationPane");
+ }
+
+ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
+ {
+ base.OnPropertyChanged(change);
+
+ if (change.Property == BoundsProperty && _splitView is not null)
+ {
+ var oldBounds = change.OldValue.GetValueOrDefault();
+ var newBounds = change.NewValue.GetValueOrDefault();
+ EnsureSplitViewMode(oldBounds, newBounds);
+ }
+ }
+
+ private void EnsureSplitViewMode(Rect oldBounds, Rect newBounds)
+ {
+ if (_splitView is not null)
+ {
+ var threshold = ExpandedModeThresholdWidth;
+
+ if (newBounds.Width >= threshold && oldBounds.Width < threshold)
+ {
+ _splitView.DisplayMode = SplitViewDisplayMode.Inline;
+ _splitView.IsPaneOpen = true;
+ }
+ else if (newBounds.Width < threshold && oldBounds.Width >= threshold)
+ {
+ _splitView.DisplayMode = SplitViewDisplayMode.Overlay;
+ _splitView.IsPaneOpen = false;
+ }
+ }
+ }
+ }
+}
diff --git a/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml b/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml
new file mode 100644
index 0000000000..1aa7f8ea04
--- /dev/null
+++ b/samples/SampleControls/HamburgerMenu/HamburgerMenu.xaml
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 40
+ 200
+ 36
+ 36
+ 32
+ 12,0,0,0
+ 52,0,0,0
+ 212,0,0,0
+ 1 1 1 1 #2000, 0 0 1 1 #2fff
+ 0 0 1 1 #2000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Avalonia.Themes.Default/SplitView.xaml b/src/Avalonia.Themes.Default/SplitView.xaml
index 18da3edb46..10eda2d9cd 100644
--- a/src/Avalonia.Themes.Default/SplitView.xaml
+++ b/src/Avalonia.Themes.Default/SplitView.xaml
@@ -1,14 +1,29 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:sys="using:System">
+
+
+
+
+
+
+
+
+
+
+
+
320
48
-
+ 00:00:00.2
+ 00:00:00.1
+ 0.1,0.9,0.2,1.0
+
-
diff --git a/src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml b/src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml
index f9adaf715b..0bcffc52f7 100644
--- a/src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml
+++ b/src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml
@@ -93,7 +93,7 @@
-