Browse Source

Merge branch 'master' into norxui

pull/5060/head
Dan Walmsley 5 years ago
committed by GitHub
parent
commit
7aac204a67
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      Documentation/build.md
  2. 3
      build/EmbedXaml.props
  3. 2
      native/Avalonia.Native/src/OSX/platformthreading.mm
  4. 10
      native/Avalonia.Native/src/OSX/rendertarget.mm
  5. 4
      samples/ControlCatalog/App.xaml.cs
  6. 30
      samples/ControlCatalog/DecoratedWindow.xaml
  7. 66
      samples/ControlCatalog/MainWindow.xaml
  8. 2
      samples/ControlCatalog/MainWindow.xaml.cs
  9. 29
      samples/ControlCatalog/Pages/DialogsPage.xaml.cs
  10. 2
      samples/RenderDemo/App.xaml
  11. 2
      samples/Sandbox/App.axaml
  12. 18
      src/Avalonia.Base/Collections/AvaloniaList.cs
  13. 24
      src/Avalonia.Base/Utilities/AvaloniaPropertyValueStore.cs
  14. 11
      src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj
  15. 4
      src/Avalonia.Build.Tasks/SpanCompat.cs
  16. 7
      src/Avalonia.Controls/AutoCompleteBox.cs
  17. 60
      src/Avalonia.Controls/DefinitionList.cs
  18. 4
      src/Avalonia.Controls/Generators/ItemContainerInfo.cs
  19. 10
      src/Avalonia.Controls/GridLength.cs
  20. 3
      src/Avalonia.Controls/NativeMenuBar.cs
  21. 18
      src/Avalonia.Controls/NativeMenuItem.cs
  22. 2
      src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
  23. 2
      src/Avalonia.Controls/Primitives/ScrollBar.cs
  24. 11
      src/Avalonia.Controls/Slider.cs
  25. 2
      src/Avalonia.Input/NavigationDirection.cs
  26. 2
      src/Avalonia.Native/AvaloniaNativeMenuExporter.cs
  27. 31
      src/Avalonia.Native/DoubleClickHelper.cs
  28. 8
      src/Avalonia.Native/Extensions.cs
  29. 2
      src/Avalonia.Native/IAvnMenuItem.cs
  30. 6
      src/Avalonia.Native/PlatformThreadingInterface.cs
  31. 4
      src/Avalonia.Native/PopupImpl.cs
  32. 4
      src/Avalonia.Native/PredicateCallback.cs
  33. 2
      src/Avalonia.Native/ScreenImpl.cs
  34. 2
      src/Avalonia.Native/SystemDialogs.cs
  35. 34
      src/Avalonia.Native/WindowImpl.cs
  36. 14
      src/Avalonia.Native/WindowImplBase.cs
  37. 1
      src/Avalonia.Native/avn.idl
  38. 3
      src/Avalonia.Styling/ApiCompatBaseline.txt
  39. 13
      src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs
  40. 15
      src/Avalonia.Themes.Default/PathIcon.xaml
  41. 2
      src/Avalonia.Themes.Default/ToggleSwitch.xaml
  42. 3
      src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt
  43. 0
      src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml
  44. 0
      src/Avalonia.Themes.Fluent/Controls/Button.xaml
  45. 0
      src/Avalonia.Themes.Fluent/Controls/ButtonSpinner.xaml
  46. 0
      src/Avalonia.Themes.Fluent/Controls/Calendar.xaml
  47. 0
      src/Avalonia.Themes.Fluent/Controls/CalendarButton.xaml
  48. 0
      src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml
  49. 0
      src/Avalonia.Themes.Fluent/Controls/CalendarDayButton.xaml
  50. 0
      src/Avalonia.Themes.Fluent/Controls/CalendarItem.xaml
  51. 0
      src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml
  52. 0
      src/Avalonia.Themes.Fluent/Controls/Carousel.xaml
  53. 0
      src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml
  54. 0
      src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml
  55. 0
      src/Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml
  56. 0
      src/Avalonia.Themes.Fluent/Controls/Common.xaml
  57. 0
      src/Avalonia.Themes.Fluent/Controls/ContentControl.xaml
  58. 0
      src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml
  59. 0
      src/Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml
  60. 0
      src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
  61. 0
      src/Avalonia.Themes.Fluent/Controls/EmbeddableControlRoot.xaml
  62. 0
      src/Avalonia.Themes.Fluent/Controls/Expander.xaml
  63. 62
      src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml
  64. 4
      src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml.cs
  65. 0
      src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml
  66. 0
      src/Avalonia.Themes.Fluent/Controls/GridSplitter.xaml
  67. 0
      src/Avalonia.Themes.Fluent/Controls/ItemsControl.xaml
  68. 0
      src/Avalonia.Themes.Fluent/Controls/Label.xaml
  69. 0
      src/Avalonia.Themes.Fluent/Controls/ListBox.xaml
  70. 0
      src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml
  71. 0
      src/Avalonia.Themes.Fluent/Controls/Menu.xaml
  72. 0
      src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml
  73. 0
      src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml
  74. 0
      src/Avalonia.Themes.Fluent/Controls/NotificationCard.xaml
  75. 0
      src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml
  76. 0
      src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml
  77. 15
      src/Avalonia.Themes.Fluent/Controls/PathIcon.xaml
  78. 0
      src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml
  79. 0
      src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml
  80. 0
      src/Avalonia.Themes.Fluent/Controls/RadioButton.xaml
  81. 0
      src/Avalonia.Themes.Fluent/Controls/RepeatButton.xaml
  82. 0
      src/Avalonia.Themes.Fluent/Controls/ScrollBar.xaml
  83. 0
      src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml
  84. 0
      src/Avalonia.Themes.Fluent/Controls/Separator.xaml
  85. 0
      src/Avalonia.Themes.Fluent/Controls/Slider.xaml
  86. 0
      src/Avalonia.Themes.Fluent/Controls/SplitView.xaml
  87. 0
      src/Avalonia.Themes.Fluent/Controls/TabControl.xaml
  88. 0
      src/Avalonia.Themes.Fluent/Controls/TabItem.xaml
  89. 0
      src/Avalonia.Themes.Fluent/Controls/TabStrip.xaml
  90. 0
      src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml
  91. 0
      src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
  92. 0
      src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
  93. 0
      src/Avalonia.Themes.Fluent/Controls/TitleBar.xaml
  94. 0
      src/Avalonia.Themes.Fluent/Controls/ToggleButton.xaml
  95. 2
      src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml
  96. 0
      src/Avalonia.Themes.Fluent/Controls/ToolTip.xaml
  97. 0
      src/Avalonia.Themes.Fluent/Controls/TreeView.xaml
  98. 0
      src/Avalonia.Themes.Fluent/Controls/TreeViewItem.xaml
  99. 0
      src/Avalonia.Themes.Fluent/Controls/UserControl.xaml
  100. 0
      src/Avalonia.Themes.Fluent/Controls/Window.xaml

11
Documentation/build.md

@ -60,15 +60,10 @@ git submodule update --init --recursive
### Build native libraries (macOS only)
On macOS it is necessary to build and manually install the respective native libraries using [Xcode](https://developer.apple.com/xcode/). The steps to get this working correctly are:
- (for revisions after 2 Nov 2020) Run `./build.sh GenerateCppHeaders` to generate `avalonia-native.h` from `avn.idl`
- Navigate to the Avalonia/native/Avalonia.Native/src/OSX folder and open the `Avalonia.Native.OSX.xcodeproj` project
- Build the library via the Product->Build menu. This will generate binaries in your local path under ~/Library/Developer/Xcode/DerivedData/Avalonia.Native.OSX-*guid* where "guid" is uniquely generated every time you build.
- Manually install the native library by copying it from the build artifacts folder into the shared dynamic library path:
On macOS it is necessary to build and manually install the respective native libraries using [Xcode](https://developer.apple.com/xcode/). Execute the build script in the root project with the `CompileNative` task. It will build the headers, build the libraries, and place them in the appropriate place to allow .NET to find them at compilation and run time.
```
cd ~/Library/Developer/Xcode/DerivedData/Avalonia.Native.OSX-[guid]/Build/Products/Debug
cp libAvalonia.Native.OSX.dylib /usr/local/lib/libAvaloniaNative.dylib
```bash
./build.sh CompileNative
```
### Build and Run Avalonia

3
build/EmbedXaml.props

@ -4,8 +4,9 @@
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<None Remove="**\*.xaml"/>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
</AvaloniaResource>
</ItemGroup>
</Project>
</Project>

2
native/Avalonia.Native/src/OSX/platformthreading.mm

@ -101,7 +101,7 @@ public:
virtual bool GetCurrentThreadIsLoopThread() override
{
return [[NSThread currentThread] isMainThread];
return [NSThread isMainThread];
}
virtual void SetSignaledCallback(IAvnSignaledCallback* cb) override
{

10
native/Avalonia.Native/src/OSX/rendertarget.mm

@ -2,6 +2,7 @@
#include "rendertarget.h"
#import <IOSurface/IOSurface.h>
#import <IOSurface/IOSurfaceObjC.h>
#import <QuartzCore/QuartzCore.h>
#include <OpenGL/CGLIOSurface.h>
#include <OpenGL/OpenGL.h>
@ -143,13 +144,17 @@ static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* ta
return _layer;
}
- (void)resize:(AvnPixelSize)size withScale: (float) scale;{
- (void)resize:(AvnPixelSize)size withScale: (float) scale{
@synchronized (lock) {
if(surface == nil
|| surface->size.Width != size.Width
|| surface->size.Height != size.Height
|| surface->scale != scale)
{
surface = [[IOSurfaceHolder alloc] initWithSize:size withScale:scale withOpenGlContext:_glContext.getRaw()];
[self updateLayer];
}
}
}
@ -159,12 +164,15 @@ static IAvnGlSurfaceRenderTarget* CreateGlRenderTarget(IOSurfaceRenderTarget* ta
@synchronized (lock) {
if(_layer == nil)
return;
[CATransaction begin];
[_layer setContents: nil];
if(surface != nil)
{
[_layer setContentsScale: surface->scale];
[_layer setContents: (__bridge IOSurface*) surface->surface];
}
[CATransaction commit];
[CATransaction flush];
}
}
else

4
samples/ControlCatalog/App.xaml.cs

@ -23,7 +23,7 @@ namespace ControlCatalog
{
new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
{
Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml")
Source = new Uri("avares://Avalonia.Themes.Fluent/FluentDark.xaml")
},
DataGridFluent
};
@ -32,7 +32,7 @@ namespace ControlCatalog
{
new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
{
Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml")
Source = new Uri("avares://Avalonia.Themes.Fluent/FluentLight.xaml")
},
DataGridFluent
};

30
samples/ControlCatalog/DecoratedWindow.xaml

@ -6,25 +6,21 @@
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem Header="Decorated">
<NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Open"/>
<NativeMenuItem Header="Recent">
<NativeMenuItem.Menu>
<NativeMenu/>
</NativeMenuItem.Menu>
</NativeMenuItem>
<NativeMenuItem Header="Quit Avalonia" Gesture="CMD+Q"/>
</NativeMenu>
</NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Open"/>
<NativeMenuItem Header="Recent">
<NativeMenuItem.Menu>
<NativeMenu/>
</NativeMenuItem.Menu>
</NativeMenuItem>
<NativeMenuItem Header="Quit Avalonia" Gesture="CMD+Q"/>
</NativeMenu>
</NativeMenuItem>
<NativeMenuItem Header="Edit">
<NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Copy"/>
<NativeMenuItem Header="Paste"/>
</NativeMenu>
</NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Copy"/>
<NativeMenuItem Header="Paste"/>
</NativeMenu>
</NativeMenuItem>
</NativeMenu>
</NativeMenu.Menu>

66
samples/ControlCatalog/MainWindow.xaml

@ -16,47 +16,39 @@
<NativeMenu.Menu>
<NativeMenu>
<NativeMenuItem Header="File">
<NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Icon="/Assets/test_icon.ico" Header="Open" Clicked="OnOpenClicked" Gesture="Ctrl+O"/>
<NativeMenuItemSeperator/>
<NativeMenuItem Icon="/Assets/github_icon.png" Header="Recent">
<NativeMenuItem.Menu>
<NativeMenu/>
</NativeMenuItem.Menu>
</NativeMenuItem>
<NativeMenuItemSeperator/>
<NativeMenuItem Header="{x:Static local:MainWindow.MenuQuitHeader}"
Gesture="{x:Static local:MainWindow.MenuQuitGesture}"
Clicked="OnCloseClicked" />
</NativeMenu>
</NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Icon="/Assets/test_icon.ico" Header="Open" Clicked="OnOpenClicked" Gesture="Ctrl+O"/>
<NativeMenuItemSeperator/>
<NativeMenuItem Icon="/Assets/github_icon.png" Header="Recent">
<NativeMenu/>
</NativeMenuItem>
<NativeMenuItemSeperator/>
<NativeMenuItem Header="{x:Static local:MainWindow.MenuQuitHeader}"
Gesture="{x:Static local:MainWindow.MenuQuitGesture}"
Clicked="OnCloseClicked" />
</NativeMenu>
</NativeMenuItem>
<NativeMenuItem Header="Edit">
<NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Copy"/>
<NativeMenuItem Header="Paste"/>
</NativeMenu>
</NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Copy"/>
<NativeMenuItem Header="Paste"/>
</NativeMenu>
</NativeMenuItem>
<NativeMenuItem Header="Options">
<NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Check Me (None)"
Command="{Binding ToggleMenuItemCheckedCommand}"
ToggleType="None"
IsChecked="{Binding IsMenuItemChecked}" />
<NativeMenuItem Header="Check Me (CheckBox)"
Command="{Binding ToggleMenuItemCheckedCommand}"
ToggleType="CheckBox"
IsChecked="{Binding IsMenuItemChecked}" />
<NativeMenuItem Header="Check Me (Radio)"
Command="{Binding ToggleMenuItemCheckedCommand}"
ToggleType="Radio"
IsChecked="{Binding IsMenuItemChecked}" />
</NativeMenu>
</NativeMenuItem.Menu>
<NativeMenu>
<NativeMenuItem Header="Check Me (None)"
Command="{Binding ToggleMenuItemCheckedCommand}"
ToggleType="None"
IsChecked="{Binding IsMenuItemChecked}" />
<NativeMenuItem Header="Check Me (CheckBox)"
Command="{Binding ToggleMenuItemCheckedCommand}"
ToggleType="CheckBox"
IsChecked="{Binding IsMenuItemChecked}" />
<NativeMenuItem Header="Check Me (Radio)"
Command="{Binding ToggleMenuItemCheckedCommand}"
ToggleType="Radio"
IsChecked="{Binding IsMenuItemChecked}" />
</NativeMenu>
</NativeMenuItem>
</NativeMenu>
</NativeMenu.Menu>

2
samples/ControlCatalog/MainWindow.xaml.cs

@ -67,7 +67,7 @@ namespace ControlCatalog
if (Application.Current.Styles.Contains(App.FluentDark)
|| Application.Current.Styles.Contains(App.FluentLight))
{
var theme = new Avalonia.Themes.Fluent.FluentTheme();
var theme = new Avalonia.Themes.Fluent.Controls.FluentControls();
theme.TryGetResource("Button", out _);
}
else

29
samples/ControlCatalog/Pages/DialogsPage.xaml.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Reflection;
using Avalonia.Controls;
using Avalonia.Dialogs;
using Avalonia.Layout;
using Avalonia.Markup.Xaml;
#pragma warning disable 4014
@ -112,11 +113,29 @@ namespace ControlCatalog.Pages
private Window CreateSampleWindow()
{
var window = new Window();
window.Height = 200;
window.Width = 200;
window.Content = new TextBlock { Text = "Hello world!" };
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
Button button;
var window = new Window
{
Height = 200,
Width = 200,
Content = new StackPanel
{
Spacing = 4,
Children =
{
new TextBlock { Text = "Hello world!" },
(button = new Button
{
HorizontalAlignment = HorizontalAlignment.Center,
Content = "Click to close"
})
}
},
WindowStartupLocation = WindowStartupLocation.CenterOwner
};
button.Click += (_, __) => window.Close();
return window;
}

2
samples/RenderDemo/App.xaml

@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="RenderDemo.App">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentLight.xaml"/>
<StyleInclude Source="avares://RenderDemo/SideBar.xaml"/>
</Application.Styles>
</Application>

2
samples/Sandbox/App.axaml

@ -3,6 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Sandbox.App">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentDark.xaml"/>
</Application.Styles>
</Application>

18
src/Avalonia.Base/Collections/AvaloniaList.cs

@ -63,6 +63,15 @@ namespace Avalonia.Collections
_inner = new List<T>();
}
/// <summary>
/// Initializes a new instance of the <see cref="AvaloniaList{T}"/>.
/// </summary>
/// <param name="capacity">Initial list capacity.</param>
public AvaloniaList(int capacity)
{
_inner = new List<T>(capacity);
}
/// <summary>
/// Initializes a new instance of the <see cref="AvaloniaList{T}"/> class.
/// </summary>
@ -175,6 +184,15 @@ namespace Avalonia.Collections
set { this[index] = (T)value; }
}
/// <summary>
/// Gets or sets the total number of elements the internal data structure can hold without resizing.
/// </summary>
public int Capacity
{
get => _inner.Capacity;
set => _inner.Capacity = value;
}
/// <summary>
/// Adds an item to the collection.
/// </summary>

24
src/Avalonia.Base/Utilities/AvaloniaPropertyValueStore.cs

@ -1,5 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#nullable enable
namespace Avalonia.Utilities
{
@ -9,12 +12,14 @@ namespace Avalonia.Utilities
/// <typeparam name="TValue">Stored value type.</typeparam>
internal sealed class AvaloniaPropertyValueStore<TValue>
{
// The last item in the list is always int.MaxValue.
private static readonly Entry[] s_emptyEntries = { new Entry { PropertyId = int.MaxValue, Value = default! } };
private Entry[] _entries;
public AvaloniaPropertyValueStore()
{
// The last item in the list is always int.MaxValue
_entries = new[] { new Entry { PropertyId = int.MaxValue, Value = default } };
_entries = s_emptyEntries;
}
private (int, bool) TryFindEntry(int propertyId)
@ -86,7 +91,7 @@ namespace Avalonia.Utilities
return (0, false);
}
public bool TryGetValue(AvaloniaProperty property, out TValue value)
public bool TryGetValue(AvaloniaProperty property, [MaybeNull] out TValue value)
{
(int index, bool found) = TryFindEntry(property.Id);
if (!found)
@ -132,7 +137,18 @@ namespace Avalonia.Utilities
if (found)
{
Entry[] entries = new Entry[_entries.Length - 1];
var newLength = _entries.Length - 1;
// Special case - one element left means that value store is empty so we can just reuse our "empty" array.
if (newLength == 1)
{
_entries = s_emptyEntries;
return;
}
var entries = new Entry[newLength];
int ix = 0;
for (int i = 0; i < _entries.Length; ++i)

11
src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="$(Configuration) == 'Debug'">netstandard2.0;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="$(Configuration) == 'Debug'">netstandard2.0;netcoreapp3.1</TargetFrameworks>
<OutputType>exe</OutputType>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<BuildOutputTargetFolder>tools</BuildOutputTargetFolder>
@ -81,6 +81,15 @@
<Compile Include="../Avalonia.Visuals/CornerRadius.cs">
<Link>Markup/%(RecursiveDir)%(FileName)%(Extension)</Link>
</Compile>
<Compile Include="../Avalonia.Visuals/Media/Color.cs">
<Link>Markup/%(RecursiveDir)%(FileName)%(Extension)</Link>
</Compile>
<Compile Include="../Avalonia.Visuals/Media/KnownColors.cs">
<Link>Markup/%(RecursiveDir)%(FileName)%(Extension)</Link>
</Compile>
<Compile Include="../Avalonia.Controls/GridLength.cs">
<Link>Markup/%(RecursiveDir)%(FileName)%(Extension)</Link>
</Compile>
<Compile Remove="../Markup/Avalonia.Markup.Xaml.Loader\xamlil.github\**\obj\**\*.cs" />
<Compile Remove="../Markup/Avalonia.Markup.Xaml.Loader\xamlil.github\src\XamlX\IL\SreTypeSystem.cs" />
<PackageReference Include="Mono.Cecil" Version="0.11.2" />

4
src/Avalonia.Build.Tasks/SpanCompat.cs

@ -1,3 +1,4 @@
#if !NETCOREAPP3_1
namespace System
{
// This is a hack to enable our span code to work inside MSBuild task without referencing System.Memory
@ -63,6 +64,8 @@ namespace System
}
public override string ToString() => _length == 0 ? string.Empty : _s.Substring(_start, _length);
public static implicit operator ReadOnlySpan<T>(char[] arr) => new ReadOnlySpan<T>(new string(arr));
}
static class SpanCompatExtensions
@ -71,3 +74,4 @@ namespace System
}
}
#endif

7
src/Avalonia.Controls/AutoCompleteBox.cs

@ -1405,8 +1405,11 @@ namespace Avalonia.Controls
break;
case Key.Enter:
OnAdapterSelectionComplete(this, new RoutedEventArgs());
e.Handled = true;
if (IsDropDownOpen)
{
OnAdapterSelectionComplete(this, new RoutedEventArgs());
e.Handled = true;
}
break;
default:

60
src/Avalonia.Controls/DefinitionList.cs

@ -1,8 +1,9 @@
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using Avalonia.Collections;
#nullable enable
namespace Avalonia.Controls
{
public abstract class DefinitionList<T> : AvaloniaList<T> where T : DefinitionBase
@ -14,44 +15,65 @@ namespace Avalonia.Controls
}
internal bool IsDirty = true;
private Grid _parent;
private Grid? _parent;
internal Grid Parent
internal Grid? Parent
{
get => _parent;
set => SetParent(value);
}
private void SetParent(Grid value)
private void SetParent(Grid? value)
{
_parent = value;
foreach (var pair in this.Select((definitions, index) => (definitions, index)))
var idx = 0;
foreach (T definition in this)
{
pair.definitions.Parent = value;
pair.definitions.Index = pair.index;
definition.Parent = value;
definition.Index = idx++;
}
}
internal void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
foreach (var nI in this.Select((d, i) => (d, i)))
nI.d._parentIndex = nI.i;
var idx = 0;
foreach (var nD in e.NewItems?.Cast<DefinitionBase>()
?? Enumerable.Empty<DefinitionBase>())
foreach (T definition in this)
{
nD.Parent = this.Parent;
nD.OnEnterParentTree();
definition.Index = idx++;
}
UpdateDefinitionParent(e.NewItems, false);
UpdateDefinitionParent(e.OldItems, true);
IsDirty = true;
}
foreach (var oD in e.OldItems?.Cast<DefinitionBase>()
?? Enumerable.Empty<DefinitionBase>())
private void UpdateDefinitionParent(IList? items, bool wasRemoved)
{
if (items is null)
{
oD.OnExitParentTree();
return;
}
var count = items.Count;
IsDirty = true;
for (var i = 0; i < count; i++)
{
var definition = (DefinitionBase) items[i];
if (wasRemoved)
{
definition.OnExitParentTree();
}
else
{
definition.Parent = Parent;
definition.OnEnterParentTree();
}
}
}
}
}
}

4
src/Avalonia.Controls/Generators/ItemContainerInfo.cs

@ -37,6 +37,6 @@ namespace Avalonia.Controls.Generators
/// <summary>
/// Gets the index of the item in the <see cref="ItemsControl.Items"/> collection.
/// </summary>
public int Index { get; internal set; }
public int Index { get; set; }
}
}
}

10
src/Avalonia.Controls/GridLength.cs

@ -8,7 +8,10 @@ namespace Avalonia.Controls
/// <summary>
/// Defines the valid units for a <see cref="GridLength"/>.
/// </summary>
public enum GridUnitType
#if !BUILDTASK
public
#endif
enum GridUnitType
{
/// <summary>
/// The row or column is auto-sized to fit its content.
@ -29,7 +32,10 @@ namespace Avalonia.Controls
/// <summary>
/// Holds the width or height of a <see cref="Grid"/>'s column and row definitions.
/// </summary>
public struct GridLength : IEquatable<GridLength>
#if !BUILDTASK
public
#endif
struct GridLength : IEquatable<GridLength>
{
private readonly GridUnitType _type;

3
src/Avalonia.Controls/NativeMenuBar.cs

@ -1,7 +1,6 @@
using System;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity;
using Avalonia.Styling;
namespace Avalonia.Controls
{
@ -16,7 +15,7 @@ namespace Avalonia.Controls
EnableMenuItemClickForwardingProperty.Changed.Subscribe(args =>
{
var item = (MenuItem)args.Sender;
if (args.NewValue.Equals(true))
if (args.NewValue.GetValueOrDefault<bool>())
item.Click += OnMenuItemClick;
else
item.Click -= OnMenuItemClick;

18
src/Avalonia.Controls/NativeMenuItem.cs

@ -2,6 +2,7 @@ using System;
using System.Windows.Input;
using Avalonia.Input;
using Avalonia.Media.Imaging;
using Avalonia.Metadata;
using Avalonia.Utilities;
namespace Avalonia.Controls
@ -62,6 +63,7 @@ namespace Avalonia.Controls
public static readonly DirectProperty<NativeMenuItem, NativeMenu> MenuProperty =
AvaloniaProperty.RegisterDirect<NativeMenuItem, NativeMenu>(nameof(Menu), o => o.Menu, (o, v) => o.Menu = v);
[Content]
public NativeMenu Menu
{
get => _menu;
@ -151,7 +153,7 @@ namespace Avalonia.Controls
IsEnabled = _command?.CanExecute(null) ?? true;
}
public bool HasClickHandlers => Clicked != null;
public bool HasClickHandlers => Click != null;
public ICommand Command
{
@ -182,11 +184,21 @@ namespace Avalonia.Controls
set { SetValue(CommandParameterProperty, value); }
}
public event EventHandler Clicked;
/// <summary>
/// Occurs when a <see cref="NativeMenuItem"/> is clicked.
/// </summary>
public event EventHandler Click;
[Obsolete("Use Click event.")]
public event EventHandler Clicked
{
add => Click += value;
remove => Click -= value;
}
void INativeMenuItemExporterEventsImplBridge.RaiseClicked()
{
Clicked?.Invoke(this, new EventArgs());
Click?.Invoke(this, new EventArgs());
if (Command?.CanExecute(CommandParameter) == true)
{

2
src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs

@ -231,7 +231,7 @@ namespace Avalonia.Controls.Platform
{
var direction = e.Key.ToNavigationDirection();
if (direction.HasValue)
if (direction?.IsDirectional() == true)
{
if (item == null && _isContextMenu)
{

2
src/Avalonia.Controls/Primitives/ScrollBar.cs

@ -35,7 +35,7 @@ namespace Avalonia.Controls.Primitives
/// Defines the <see cref="Visibility"/> property.
/// </summary>
public static readonly StyledProperty<ScrollBarVisibility> VisibilityProperty =
AvaloniaProperty.Register<ScrollBar, ScrollBarVisibility>(nameof(Visibility));
AvaloniaProperty.Register<ScrollBar, ScrollBarVisibility>(nameof(Visibility), ScrollBarVisibility.Visible);
/// <summary>
/// Defines the <see cref="Orientation"/> property.

11
src/Avalonia.Controls/Slider.cs

@ -3,6 +3,7 @@ using Avalonia.Collections;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Mixins;
using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Layout;
@ -94,6 +95,8 @@ namespace Avalonia.Controls
Thumb.DragStartedEvent.AddClassHandler<Slider>((x, e) => x.OnThumbDragStarted(e), RoutingStrategies.Bubble);
Thumb.DragCompletedEvent.AddClassHandler<Slider>((x, e) => x.OnThumbDragCompleted(e),
RoutingStrategies.Bubble);
ValueProperty.OverrideMetadata<Slider>(new DirectPropertyMetadata<double>(enableDataValidation: true));
}
/// <summary>
@ -225,6 +228,14 @@ namespace Avalonia.Controls
Value = IsSnapToTickEnabled ? SnapToTick(finalValue) : finalValue;
}
protected override void UpdateDataValidation<T>(AvaloniaProperty<T> property, BindingValue<T> value)
{
if (property == ValueProperty)
{
DataValidationErrors.SetError(this, value.Error);
}
}
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
{
base.OnPropertyChanged(change);

2
src/Avalonia.Input/NavigationDirection.cs

@ -83,7 +83,7 @@ namespace Avalonia.Input
/// </returns>
public static bool IsDirectional(this NavigationDirection direction)
{
return direction > NavigationDirection.Previous ||
return direction > NavigationDirection.Previous &&
direction <= NavigationDirection.PageDown;
}

2
src/Avalonia.Native/AvaloniaNativeMenuExporter.cs

@ -60,7 +60,7 @@ namespace Avalonia.Native
Header = "About Avalonia",
};
aboutItem.Clicked += async (sender, e) =>
aboutItem.Click += async (sender, e) =>
{
var dialog = new AboutAvaloniaDialog();

31
src/Avalonia.Native/DoubleClickHelper.cs

@ -0,0 +1,31 @@
using Avalonia.Platform;
namespace Avalonia.Native
{
internal class DoubleClickHelper
{
private int _clickCount;
private Rect _lastClickRect;
private ulong _lastClickTime;
public bool IsDoubleClick(
ulong timestamp,
Point p)
{
var settings = AvaloniaLocator.Current.GetService<IPlatformSettings>();
var doubleClickTime = settings.DoubleClickTime.TotalMilliseconds;
if (!_lastClickRect.Contains(p) || timestamp - _lastClickTime > doubleClickTime)
{
_clickCount = 0;
}
++_clickCount;
_lastClickTime = timestamp;
_lastClickRect = new Rect(p, new Size())
.Inflate(new Thickness(settings.DoubleClickSize.Width / 2, settings.DoubleClickSize.Height / 2));
return _clickCount == 2;
}
}
}

8
src/Avalonia.Native/Extensions.cs

@ -0,0 +1,8 @@
namespace Avalonia.Native
{
internal static class Extensions
{
public static int AsComBool(this bool b) => b ? 1 : 0;
public static bool FromComBool(this int b) => b != 0;
}
}

2
src/Avalonia.Native/IAvnMenuItem.cs

@ -24,7 +24,7 @@ namespace Avalonia.Native.Interop.Impl
private void UpdateTitle(string title) => SetTitle(title ?? "");
private void UpdateIsChecked(bool isChecked) => SetIsChecked(isChecked);
private void UpdateIsChecked(bool isChecked) => SetIsChecked(isChecked.AsComBool());
private void UpdateToggleType(NativeMenuItemToggleType toggleType)
{

6
src/Avalonia.Native/PlatformThreadingInterface.cs

@ -33,9 +33,9 @@ namespace Avalonia.Native
_parent = parent;
}
public void Signaled(int priority, bool priorityContainsMeaningfulValue)
public void Signaled(int priority, int priorityContainsMeaningfulValue)
{
_parent.Signaled?.Invoke(priorityContainsMeaningfulValue ? (DispatcherPriority?)priority : null);
_parent.Signaled?.Invoke(priorityContainsMeaningfulValue.FromComBool() ? (DispatcherPriority?)priority : null);
}
}
@ -50,7 +50,7 @@ namespace Avalonia.Native
_native.SetSignaledCallback(cb);
}
public bool CurrentThreadIsLoopThread => _native.CurrentThreadIsLoopThread;
public bool CurrentThreadIsLoopThread => _native.CurrentThreadIsLoopThread.FromComBool();
public event Action<DispatcherPriority?> Signaled;

4
src/Avalonia.Native/PopupImpl.cs

@ -50,9 +50,9 @@ namespace Avalonia.Native
// NOP on Popup
}
bool IAvnWindowEvents.Closing()
int IAvnWindowEvents.Closing()
{
return true;
return true.AsComBool();
}
void IAvnWindowEvents.WindowStateChanged(AvnWindowState state)

4
src/Avalonia.Native/PredicateCallback.cs

@ -12,9 +12,9 @@ namespace Avalonia.Native
_predicate = predicate;
}
bool IAvnPredicateCallback.Evaluate()
int IAvnPredicateCallback.Evaluate()
{
return _predicate();
return _predicate().AsComBool();
}
}
}

2
src/Avalonia.Native/ScreenImpl.cs

@ -33,7 +33,7 @@ namespace Avalonia.Native
screen.PixelDensity,
screen.Bounds.ToAvaloniaPixelRect(),
screen.WorkingArea.ToAvaloniaPixelRect(),
screen.Primary);
screen.Primary.FromComBool());
}
return result;

2
src/Avalonia.Native/SystemDialogs.cs

@ -26,7 +26,7 @@ namespace Avalonia.Native
if (dialog is OpenFileDialog ofd)
{
_native.OpenFileDialog(nativeParent,
events, ofd.AllowMultiple,
events, ofd.AllowMultiple.AsComBool(),
ofd.Title ?? "",
ofd.Directory ?? "",
ofd.InitialFileName ?? "",

34
src/Avalonia.Native/WindowImpl.cs

@ -1,4 +1,5 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Platform;
using Avalonia.Input;
@ -17,6 +18,8 @@ namespace Avalonia.Native
private readonly AvaloniaNativePlatformOpenGlInterface _glFeature;
IAvnWindow _native;
private double _extendTitleBarHeight = -1;
private DoubleClickHelper _doubleClickHelper;
internal WindowImpl(IAvaloniaNativeFactory factory, AvaloniaNativePlatformOptions opts,
AvaloniaNativePlatformOpenGlInterface glFeature) : base(opts, glFeature)
@ -24,6 +27,8 @@ namespace Avalonia.Native
_factory = factory;
_opts = opts;
_glFeature = glFeature;
_doubleClickHelper = new DoubleClickHelper();
using (var e = new WindowEvents(this))
{
var context = _opts.UseGpu ? glFeature?.MainContext : null;
@ -42,14 +47,14 @@ namespace Avalonia.Native
_parent = parent;
}
bool IAvnWindowEvents.Closing()
int IAvnWindowEvents.Closing()
{
if (_parent.Closing != null)
{
return _parent.Closing();
return _parent.Closing().AsComBool();
}
return true;
return true.AsComBool();
}
void IAvnWindowEvents.WindowStateChanged(AvnWindowState state)
@ -69,7 +74,7 @@ namespace Avalonia.Native
public void CanResize(bool value)
{
_native.SetCanResize(value);
_native.SetCanResize(value.AsComBool());
}
public void SetSystemDecorations(Controls.SystemDecorations enabled)
@ -118,7 +123,22 @@ namespace Avalonia.Native
if(visual == null)
{
_native.BeginMoveDrag();
if (_doubleClickHelper.IsDoubleClick(e.Timestamp, e.Position))
{
// TOGGLE WINDOW STATE.
if (WindowState == WindowState.Maximized || WindowState == WindowState.FullScreen)
{
WindowState = WindowState.Normal;
}
else
{
WindowState = WindowState.Maximized;
}
}
else
{
_native.BeginMoveDrag();
}
}
}
}
@ -145,7 +165,7 @@ namespace Avalonia.Native
{
_isExtended = extendIntoClientAreaHint;
_native.SetExtendClientArea(extendIntoClientAreaHint);
_native.SetExtendClientArea(extendIntoClientAreaHint.AsComBool());
InvalidateExtendedMargins();
}
@ -198,7 +218,7 @@ namespace Avalonia.Native
public void SetEnabled(bool enable)
{
_native.SetEnabled(enable);
_native.SetEnabled(enable.AsComBool());
}
}
}

14
src/Avalonia.Native/WindowImplBase.cs

@ -174,7 +174,7 @@ namespace Avalonia.Native
void IAvnWindowBaseEvents.Resized(AvnSize* size)
{
if (_parent._native != null)
if (_parent?._native != null)
{
var s = new Size(size->Width, size->Height);
_parent._savedLogicalSize = s;
@ -192,14 +192,14 @@ namespace Avalonia.Native
_parent.RawMouseEvent(type, timeStamp, modifiers, point, delta);
}
bool IAvnWindowBaseEvents.RawKeyEvent(AvnRawKeyEventType type, uint timeStamp, AvnInputModifiers modifiers, uint key)
int IAvnWindowBaseEvents.RawKeyEvent(AvnRawKeyEventType type, uint timeStamp, AvnInputModifiers modifiers, uint key)
{
return _parent.RawKeyEvent(type, timeStamp, modifiers, key);
return _parent.RawKeyEvent(type, timeStamp, modifiers, key).AsComBool();
}
bool IAvnWindowBaseEvents.RawTextInputEvent(uint timeStamp, string text)
int IAvnWindowBaseEvents.RawTextInputEvent(uint timeStamp, string text)
{
return _parent.RawTextInputEvent(timeStamp, text);
return _parent.RawTextInputEvent(timeStamp, text).AsComBool();
}
@ -388,7 +388,7 @@ namespace Avalonia.Native
public void SetTopmost(bool value)
{
_native.SetTopMost(value);
_native.SetTopMost(value.AsComBool());
}
public double RenderScaling => _native?.Scaling ?? 1;
@ -456,7 +456,7 @@ namespace Avalonia.Native
TransparencyLevel = transparencyLevel;
_native?.SetBlurEnabled(TransparencyLevel >= WindowTransparencyLevel.Blur);
_native?.SetBlurEnabled((TransparencyLevel >= WindowTransparencyLevel.Blur).AsComBool());
TransparencyLevelChanged?.Invoke(TransparencyLevel);
}
}

1
src/Avalonia.Native/avn.idl

@ -1,5 +1,6 @@
@clr-namespace Avalonia.Native.Interop
@clr-access internal
@clr-map bool int
@cpp-preamble @@
#include "com.h"
#include "key.h"

3
src/Avalonia.Styling/ApiCompatBaseline.txt

@ -0,0 +1,3 @@
Compat issues with assembly Avalonia.Styling:
MembersMustExist : Member 'public System.IObservable<System.Object> Avalonia.Controls.ResourceNodeExtensions.GetResourceObservable(Avalonia.IStyledElement, System.Object, System.Func<System.Object, System.Object>)' does not exist in the implementation but it does exist in the contract.
Total Issues: 1

13
src/Avalonia.Styling/Controls/ResourceNodeExtensions.cs

@ -60,7 +60,7 @@ namespace Avalonia.Controls
}
public static IObservable<object?> GetResourceObservable(
this IStyledElement control,
this IResourceHost control,
object key,
Func<object?, object?>? converter = null)
{
@ -83,11 +83,11 @@ namespace Avalonia.Controls
private class ResourceObservable : LightweightObservableBase<object?>
{
private readonly IStyledElement _target;
private readonly IResourceHost _target;
private readonly object _key;
private readonly Func<object?, object?>? _converter;
public ResourceObservable(IStyledElement target, object key, Func<object?, object?>? converter)
public ResourceObservable(IResourceHost target, object key, Func<object?, object?>? converter)
{
_target = target;
_key = key;
@ -147,13 +147,16 @@ namespace Avalonia.Controls
{
if (_target.Owner is object)
{
observer.OnNext(Convert(_target.Owner?.FindResource(_key)));
observer.OnNext(Convert(_target.Owner.FindResource(_key)));
}
}
private void PublishNext()
{
PublishNext(Convert(_target.Owner?.FindResource(_key)));
if (_target.Owner is object)
{
PublishNext(Convert(_target.Owner.FindResource(_key)));
}
}
private void OwnerChanged(object sender, EventArgs e)

15
src/Avalonia.Themes.Default/PathIcon.xaml

@ -2,16 +2,19 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="PathIcon">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundColor}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="{DynamicResource IconElementThemeHeight}" />
<Setter Property="Width" Value="{DynamicResource IconElementThemeWidth}" />
<Setter Property="Template">
<ControlTemplate>
<Viewbox Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}">
<Path Fill="{TemplateBinding Foreground}"
Data="{TemplateBinding Data}"
Stretch="Uniform" />
</Viewbox>
<Border Background="{TemplateBinding Background}">
<Viewbox Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}">
<Path Fill="{TemplateBinding Foreground}"
Data="{TemplateBinding Data}"
Stretch="Uniform" />
</Viewbox>
</Border>
</ControlTemplate>
</Setter>
</Style>

2
src/Avalonia.Themes.Default/ToggleSwitch.xaml

@ -5,7 +5,7 @@
<Thickness x:Key="ToggleSwitchTopHeaderMargin">0,0,0,6</Thickness>
<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>
<x:Double x:Key="ToggleSwitchThemeMinWidth">154</x:Double>
<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>
<Thickness x:Key="ToggleSwitchOnStrokeThickness">0</Thickness>
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
<SolidColorBrush x:Key="ToggleSwitchContentForeground" Color="{DynamicResource ThemeForegroundColor}" />

3
src/Avalonia.Themes.Fluent/ApiCompatBaseline.txt

@ -0,0 +1,3 @@
Compat issues with assembly Avalonia.Themes.Fluent:
TypesMustExist : Type 'Avalonia.Themes.Fluent.FluentTheme' does not exist in the implementation but it does exist in the contract.
Total Issues: 1

0
src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml → src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml

0
src/Avalonia.Themes.Fluent/Button.xaml → src/Avalonia.Themes.Fluent/Controls/Button.xaml

0
src/Avalonia.Themes.Fluent/ButtonSpinner.xaml → src/Avalonia.Themes.Fluent/Controls/ButtonSpinner.xaml

0
src/Avalonia.Themes.Fluent/Calendar.xaml → src/Avalonia.Themes.Fluent/Controls/Calendar.xaml

0
src/Avalonia.Themes.Fluent/CalendarButton.xaml → src/Avalonia.Themes.Fluent/Controls/CalendarButton.xaml

0
src/Avalonia.Themes.Fluent/CalendarDatePicker.xaml → src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml

0
src/Avalonia.Themes.Fluent/CalendarDayButton.xaml → src/Avalonia.Themes.Fluent/Controls/CalendarDayButton.xaml

0
src/Avalonia.Themes.Fluent/CalendarItem.xaml → src/Avalonia.Themes.Fluent/Controls/CalendarItem.xaml

0
src/Avalonia.Themes.Fluent/CaptionButtons.xaml → src/Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml

0
src/Avalonia.Themes.Fluent/Carousel.xaml → src/Avalonia.Themes.Fluent/Controls/Carousel.xaml

0
src/Avalonia.Themes.Fluent/CheckBox.xaml → src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml

0
src/Avalonia.Themes.Fluent/ComboBox.xaml → src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml

0
src/Avalonia.Themes.Fluent/ComboBoxItem.xaml → src/Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml

0
src/Avalonia.Themes.Fluent/Common.xaml → src/Avalonia.Themes.Fluent/Controls/Common.xaml

0
src/Avalonia.Themes.Fluent/ContentControl.xaml → src/Avalonia.Themes.Fluent/Controls/ContentControl.xaml

0
src/Avalonia.Themes.Fluent/ContextMenu.xaml → src/Avalonia.Themes.Fluent/Controls/ContextMenu.xaml

0
src/Avalonia.Themes.Fluent/DataValidationErrors.xaml → src/Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml

0
src/Avalonia.Themes.Fluent/DatePicker.xaml → src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml

0
src/Avalonia.Themes.Fluent/EmbeddableControlRoot.xaml → src/Avalonia.Themes.Fluent/Controls/EmbeddableControlRoot.xaml

0
src/Avalonia.Themes.Fluent/Expander.xaml → src/Avalonia.Themes.Fluent/Controls/Expander.xaml

62
src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml

@ -0,0 +1,62 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Avalonia.Themes.Fluent.Controls.FluentControls">
<!-- Define ToolTip first so its styles can be overriden by other controls (e.g. TextBox) -->
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ToolTip.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/DataValidationErrors.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Button.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/CaptionButtons.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Carousel.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/CheckBox.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ComboBox.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ContentControl.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Label.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/GridSplitter.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ItemsControl.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ListBox.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Menu.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ContextMenu.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/MenuItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/PathIcon.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/PopupRoot.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ProgressBar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/RadioButton.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/RepeatButton.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Separator.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Slider.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ScrollBar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TabStrip.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TabStripItem.xaml"/>
<!-- TabControl needs to come after TabStrip as it redefines the inner TabStrip.ItemsPanel-->
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TabControl.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TabItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TextBox.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ToggleButton.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Expander.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TitleBar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TreeView.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TreeViewItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/UserControl.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Window.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/EmbeddableControlRoot.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/CalendarButton.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/CalendarDayButton.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/CalendarItem.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/Calendar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ButtonSpinner.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/WindowNotificationManager.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/NotificationCard.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/SplitView.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/DatePicker.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Controls/TimePicker.xaml"/>
</Styles>

4
src/Avalonia.Themes.Fluent/FluentTheme.xaml.cs → src/Avalonia.Themes.Fluent/Controls/FluentControls.xaml.cs

@ -1,12 +1,12 @@
using Avalonia.Markup.Xaml;
using Avalonia.Styling;
namespace Avalonia.Themes.Fluent
namespace Avalonia.Themes.Fluent.Controls
{
/// <summary>
/// The default Avalonia theme.
/// </summary>
public class FluentTheme : Styles
public class FluentControls : Styles
{
}
}

0
src/Avalonia.Themes.Fluent/FocusAdorner.xaml → src/Avalonia.Themes.Fluent/Controls/FocusAdorner.xaml

0
src/Avalonia.Themes.Fluent/GridSplitter.xaml → src/Avalonia.Themes.Fluent/Controls/GridSplitter.xaml

0
src/Avalonia.Themes.Fluent/ItemsControl.xaml → src/Avalonia.Themes.Fluent/Controls/ItemsControl.xaml

0
src/Avalonia.Themes.Fluent/Label.xaml → src/Avalonia.Themes.Fluent/Controls/Label.xaml

0
src/Avalonia.Themes.Fluent/ListBox.xaml → src/Avalonia.Themes.Fluent/Controls/ListBox.xaml

0
src/Avalonia.Themes.Fluent/ListBoxItem.xaml → src/Avalonia.Themes.Fluent/Controls/ListBoxItem.xaml

0
src/Avalonia.Themes.Fluent/Menu.xaml → src/Avalonia.Themes.Fluent/Controls/Menu.xaml

0
src/Avalonia.Themes.Fluent/MenuItem.xaml → src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml

0
src/Avalonia.Themes.Fluent/NativeMenuBar.xaml → src/Avalonia.Themes.Fluent/Controls/NativeMenuBar.xaml

0
src/Avalonia.Themes.Fluent/NotificationCard.xaml → src/Avalonia.Themes.Fluent/Controls/NotificationCard.xaml

0
src/Avalonia.Themes.Fluent/NumericUpDown.xaml → src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml

0
src/Avalonia.Themes.Fluent/OverlayPopupHost.xaml → src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml

15
src/Avalonia.Themes.Fluent/PathIcon.xaml → src/Avalonia.Themes.Fluent/Controls/PathIcon.xaml

@ -10,16 +10,19 @@
</Design.PreviewWith>
<Style Selector="PathIcon">
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="{DynamicResource IconElementThemeHeight}" />
<Setter Property="Width" Value="{DynamicResource IconElementThemeWidth}" />
<Setter Property="Template">
<ControlTemplate>
<Viewbox Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}">
<Path Fill="{TemplateBinding Foreground}"
Data="{TemplateBinding Data}"
Stretch="Uniform" />
</Viewbox>
<Border Background="{TemplateBinding Background}">
<Viewbox Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}">
<Path Fill="{TemplateBinding Foreground}"
Data="{TemplateBinding Data}"
Stretch="Uniform" />
</Viewbox>
</Border>
</ControlTemplate>
</Setter>
</Style>

0
src/Avalonia.Themes.Fluent/PopupRoot.xaml → src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml

0
src/Avalonia.Themes.Fluent/ProgressBar.xaml → src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml

0
src/Avalonia.Themes.Fluent/RadioButton.xaml → src/Avalonia.Themes.Fluent/Controls/RadioButton.xaml

0
src/Avalonia.Themes.Fluent/RepeatButton.xaml → src/Avalonia.Themes.Fluent/Controls/RepeatButton.xaml

0
src/Avalonia.Themes.Fluent/ScrollBar.xaml → src/Avalonia.Themes.Fluent/Controls/ScrollBar.xaml

0
src/Avalonia.Themes.Fluent/ScrollViewer.xaml → src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml

0
src/Avalonia.Themes.Fluent/Separator.xaml → src/Avalonia.Themes.Fluent/Controls/Separator.xaml

0
src/Avalonia.Themes.Fluent/Slider.xaml → src/Avalonia.Themes.Fluent/Controls/Slider.xaml

0
src/Avalonia.Themes.Fluent/SplitView.xaml → src/Avalonia.Themes.Fluent/Controls/SplitView.xaml

0
src/Avalonia.Themes.Fluent/TabControl.xaml → src/Avalonia.Themes.Fluent/Controls/TabControl.xaml

0
src/Avalonia.Themes.Fluent/TabItem.xaml → src/Avalonia.Themes.Fluent/Controls/TabItem.xaml

0
src/Avalonia.Themes.Fluent/TabStrip.xaml → src/Avalonia.Themes.Fluent/Controls/TabStrip.xaml

0
src/Avalonia.Themes.Fluent/TabStripItem.xaml → src/Avalonia.Themes.Fluent/Controls/TabStripItem.xaml

0
src/Avalonia.Themes.Fluent/TextBox.xaml → src/Avalonia.Themes.Fluent/Controls/TextBox.xaml

0
src/Avalonia.Themes.Fluent/TimePicker.xaml → src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml

0
src/Avalonia.Themes.Fluent/TitleBar.xaml → src/Avalonia.Themes.Fluent/Controls/TitleBar.xaml

0
src/Avalonia.Themes.Fluent/ToggleButton.xaml → src/Avalonia.Themes.Fluent/Controls/ToggleButton.xaml

2
src/Avalonia.Themes.Fluent/ToggleSwitch.xaml → src/Avalonia.Themes.Fluent/Controls/ToggleSwitch.xaml

@ -5,7 +5,7 @@
<Thickness x:Key="ToggleSwitchTopHeaderMargin">0,0,0,6</Thickness>
<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>
<x:Double x:Key="ToggleSwitchThemeMinWidth">154</x:Double>
<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>
</Styles.Resources>
<Design.PreviewWith>
<StackPanel Margin="20" Width="250" Spacing="24" >

0
src/Avalonia.Themes.Fluent/ToolTip.xaml → src/Avalonia.Themes.Fluent/Controls/ToolTip.xaml

0
src/Avalonia.Themes.Fluent/TreeView.xaml → src/Avalonia.Themes.Fluent/Controls/TreeView.xaml

0
src/Avalonia.Themes.Fluent/TreeViewItem.xaml → src/Avalonia.Themes.Fluent/Controls/TreeViewItem.xaml

0
src/Avalonia.Themes.Fluent/UserControl.xaml → src/Avalonia.Themes.Fluent/Controls/UserControl.xaml

0
src/Avalonia.Themes.Fluent/Window.xaml → src/Avalonia.Themes.Fluent/Controls/Window.xaml

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save