Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into pr/136
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Apr 2, 2024
2 parents f1bc929 + 0f87e47 commit 62b1eb4
Show file tree
Hide file tree
Showing 177 changed files with 2,280 additions and 352 deletions.
12 changes: 11 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,14 @@ indent_size = 2
[*.sh]
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf
end_of_line = crlf

# Verify settings
[*.{received,verified}.{txt,xml,json}]
charset = "utf-8-bom"
end_of_line = lf
indent_size = unset
indent_style = unset
insert_final_newline = false
tab_width = unset
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain


# VerifyTests
*.png binary
*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
*.verified.json text eol=lf working-tree-encoding=UTF-8
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,6 @@ tools/**

# macOS
.DS_Store

# VerifyTests
*.received.*
9 changes: 1 addition & 8 deletions AvaloniaBehaviors.sln
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Xaml.Interactions.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Xaml.Interactions.DragAndDrop", "src\Avalonia.Xaml.Interactions.DragAndDrop\Avalonia.Xaml.Interactions.DragAndDrop.csproj", "{EF243B1A-FF29-41E9-B44B-2E55A73F6CCE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Xaml.Interactions.Reactive", "src\Avalonia.Xaml.Interactions.Reactive\Avalonia.Xaml.Interactions.Reactive.csproj", "{D647E09E-BBF2-4432-A4E0-80FBB921C1EE}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Xaml.Interactions.Custom", "src\Avalonia.Xaml.Interactions.Custom\Avalonia.Xaml.Interactions.Custom.csproj", "{D647E09E-BBF2-4432-A4E0-80FBB921C1EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Xaml.Interactions.Events", "src\Avalonia.Xaml.Interactions.Events\Avalonia.Xaml.Interactions.Events.csproj", "{648FFF6A-A8F5-491C-AC1C-19FC2061D6B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Xaml.Interactions.Custom", "src\Avalonia.Xaml.Interactions.Custom\Avalonia.Xaml.Interactions.Custom.csproj", "{0BB3669E-45E4-41E8-B765-7F4A5201C4E0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -147,10 +145,6 @@ Global
{648FFF6A-A8F5-491C-AC1C-19FC2061D6B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{648FFF6A-A8F5-491C-AC1C-19FC2061D6B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{648FFF6A-A8F5-491C-AC1C-19FC2061D6B4}.Release|Any CPU.Build.0 = Release|Any CPU
{0BB3669E-45E4-41E8-B765-7F4A5201C4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BB3669E-45E4-41E8-B765-7F4A5201C4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BB3669E-45E4-41E8-B765-7F4A5201C4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BB3669E-45E4-41E8-B765-7F4A5201C4E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -174,7 +168,6 @@ Global
{EF243B1A-FF29-41E9-B44B-2E55A73F6CCE} = {84224365-32B6-46AF-85A2-45640E6D7EEB}
{D647E09E-BBF2-4432-A4E0-80FBB921C1EE} = {84224365-32B6-46AF-85A2-45640E6D7EEB}
{648FFF6A-A8F5-491C-AC1C-19FC2061D6B4} = {84224365-32B6-46AF-85A2-45640E6D7EEB}
{0BB3669E-45E4-41E8-B765-7F4A5201C4E0} = {84224365-32B6-46AF-85A2-45640E6D7EEB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E64CD420-15B1-487C-9806-41EBE6DC15A4}
Expand Down
5 changes: 3 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<Project>
<PropertyGroup>
<VersionPrefix>11.0.2</VersionPrefix>
<VersionPrefix>11.0.10.2</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>Wiesław Šoltés</Authors>
<Company>Wiesław Šoltés</Company>
<Copyright>Copyright © Wiesław Šoltés 2023</Copyright>
<Copyright>Copyright © Wiesław Šoltés 2024</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/wieslawsoltes/AvaloniaBehaviors</PackageProjectUrl>
</PropertyGroup>
<PropertyGroup>
<AnalysisLevel>latest</AnalysisLevel>
<LangVersion>latest</LangVersion>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
</PropertyGroup>
</Project>
20 changes: 10 additions & 10 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>11.0.0</AvaloniaVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="11.0.0" />
<PackageVersion Include="Avalonia.Desktop" Version="11.0.0" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.0" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.0.0" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.0" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.0.0" />
<PackageVersion Include="Avalonia.Browser" Version="11.0.0" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="11.0.0" />
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="$(AvaloniaVersion)" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="System.Reactive" Version="6.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
<PackageVersion Include="Nuke.Common" Version="5.3.0" />
</ItemGroup>
Expand Down
26 changes: 13 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resources:
variables:
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
PublishFramework: 'net7.0'
PublishFramework: 'net8.0'
PublishProject: 'BehaviorsTestApplication'
PublishRuntime: ''

Expand Down Expand Up @@ -53,31 +53,31 @@ jobs:
BuildConfiguration: ${{ variables.BuildConfiguration }}
PublishFramework: ${{ variables.PublishFramework }}
PublishProject: ${{ variables.PublishProject }}
PublishRuntime: 'win7-x64'
PublishRuntime: 'win-x64'

- template: Publish-Bash.yml@templates
parameters:
name: 'Publish_Ubuntu'
name: 'Publish_Linux'
vmImage: 'ubuntu-20.04'
BuildConfiguration: ${{ variables.BuildConfiguration }}
PublishFramework: ${{ variables.PublishFramework }}
PublishProject: ${{ variables.PublishProject }}
PublishRuntime: 'ubuntu.14.04-x64'
PublishRuntime: 'linux-x64'

- template: Publish-Bash.yml@templates
parameters:
name: 'Publish_Debian'
vmImage: 'ubuntu-20.04'
name: 'Publish_macOS_x64'
vmImage: 'macOS-11'
BuildConfiguration: ${{ variables.BuildConfiguration }}
PublishFramework: ${{ variables.PublishFramework }}
PublishProject: ${{ variables.PublishProject }}
PublishRuntime: 'debian.8-x64'
PublishRuntime: 'osx-x64'

- template: Publish-Bash.yml@templates
parameters:
name: 'Publish_macOS'
vmImage: 'macOS-11'
BuildConfiguration: ${{ variables.BuildConfiguration }}
PublishFramework: ${{ variables.PublishFramework }}
PublishProject: ${{ variables.PublishProject }}
PublishRuntime: 'osx.10.12-x64'
name: 'Publish_macOS_arm64'
vmImage: 'macOS-11'
BuildConfiguration: ${{ variables.BuildConfiguration }}
PublishFramework: ${{ variables.PublishFramework }}
PublishProject: ${{ variables.PublishProject }}
PublishRuntime: 'osx-arm64'
3 changes: 2 additions & 1 deletion build/build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"version": "8.0.100",
"rollForward": "latestMinor",
"allowPrerelease": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IsPackable>False</IsPackable>
<Nullable>enable</Nullable>
Expand All @@ -15,7 +15,6 @@
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Fonts.Inter" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
</ItemGroup>

<!--<Import Project="..\..\build\SignAssembly.props" />-->
Expand All @@ -26,7 +25,6 @@
<ProjectReference Include="..\..\src\Avalonia.Xaml.Interactions.DragAndDrop\Avalonia.Xaml.Interactions.DragAndDrop.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Xaml.Interactions.Draggable\Avalonia.Xaml.Interactions.Draggable.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Xaml.Interactions.Events\Avalonia.Xaml.Interactions.Events.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Xaml.Interactions.Reactive\Avalonia.Xaml.Interactions.Reactive.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Xaml.Interactions.Responsive\Avalonia.Xaml.Interactions.Responsive.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Xaml.Interactivity\Avalonia.Xaml.Interactivity.csproj" />
</ItemGroup>
Expand Down
14 changes: 4 additions & 10 deletions samples/BehaviorsTestApplication/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

namespace BehaviorsTestApplication.ViewModels;

public class ItemViewModel : ViewModelBase
public class ItemViewModel(string name) : ViewModelBase
{
private string _name;
private ObservableCollection<ItemViewModel>? _items;

public string Name
{
get => _name;
set => this.RaiseAndSetIfChanged(ref _name, value);
get => name;
set => this.RaiseAndSetIfChanged(ref name, value);
}

public ObservableCollection<ItemViewModel>? Items
Expand All @@ -21,10 +20,5 @@ public ObservableCollection<ItemViewModel>? Items
set => this.RaiseAndSetIfChanged(ref _items, value);
}

public ItemViewModel(string name)
{
_name = name;
}

public override string ToString() => _name;
public override string ToString() => name;
}
20 changes: 10 additions & 10 deletions samples/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<AvaloniaVersion>11.0.10</AvaloniaVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia" Version="11.0.2" />
<PackageVersion Include="Avalonia.Desktop" Version="11.0.2" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.2" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.0.2" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.0.2" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.0.2" />
<PackageVersion Include="Avalonia.Browser" Version="11.0.2" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="11.0.2" />
<PackageVersion Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="$(AvaloniaVersion)" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="System.Reactive" Version="6.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ private bool Validate<T>(TreeView treeView, DragEventArgs e, object? sourceConte

var sourceParent = sourceNode.Parent;
var targetParent = targetNode.Parent;
var sourceNodes = sourceParent is { } ? sourceParent.Nodes : vm.Nodes;
var targetNodes = targetParent is { } ? targetParent.Nodes : vm.Nodes;
var sourceNodes = sourceParent is not null ? sourceParent.Nodes : vm.Nodes;
var targetNodes = targetParent is not null ? targetParent.Nodes : vm.Nodes;

if (sourceNodes is { } && targetNodes is { })
if (sourceNodes is not null && targetNodes is not null)
{
var sourceIndex = sourceNodes.IndexOf(sourceNode);
var targetIndex = targetNodes.IndexOf(targetNode);
Expand Down
3 changes: 1 addition & 2 deletions samples/DragAndDropSample/DragAndDropSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IsPackable>False</IsPackable>
<Nullable>enable</Nullable>
Expand All @@ -19,7 +19,6 @@
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Fonts.Inter" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
</ItemGroup>

<!--<Import Project="..\..\build\SignAssembly.props" />-->
Expand Down
3 changes: 1 addition & 2 deletions samples/DraggableDemo/DraggableDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IsPackable>False</IsPackable>
<Nullable>enable</Nullable>
Expand All @@ -19,7 +19,6 @@
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Fonts.Inter" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
</ItemGroup>

<!--<Import Project="..\..\build\SignAssembly.props" />-->
Expand Down
4 changes: 1 addition & 3 deletions src/Avalonia.Xaml.Behaviors/Avalonia.Xaml.Behaviors.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<IncludeBuildOutput>False</IncludeBuildOutput>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);NU5128</NoWarn>
Expand All @@ -15,7 +15,6 @@

<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
</ItemGroup>

<Import Project="..\..\build\SignAssembly.props" />
Expand All @@ -28,7 +27,6 @@
<ProjectReference Include="..\Avalonia.Xaml.Interactions.DragAndDrop\Avalonia.Xaml.Interactions.DragAndDrop.csproj" />
<ProjectReference Include="..\Avalonia.Xaml.Interactions.Draggable\Avalonia.Xaml.Interactions.Draggable.csproj" />
<ProjectReference Include="..\Avalonia.Xaml.Interactions.Events\Avalonia.Xaml.Interactions.Events.csproj" />
<ProjectReference Include="..\Avalonia.Xaml.Interactions.Reactive\Avalonia.Xaml.Interactions.Reactive.csproj" />
<ProjectReference Include="..\Avalonia.Xaml.Interactions.Responsive\Avalonia.Xaml.Interactions.Responsive.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Avalonia.Xaml.Interactions.Custom/AddClassAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public bool RemoveIfExists
/// <returns>True if the class is successfully added; else false.</returns>
public object Execute(object? sender, object? parameter)
{
var target = GetValue(StyledElementProperty) is { } ? StyledElement : sender as StyledElement;
var target = GetValue(StyledElementProperty) is not null ? StyledElement : sender as StyledElement;
if (target is null || string.IsNullOrEmpty(ClassName))
{
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net461;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<Nullable>enable</Nullable>
Expand All @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
<PackageReference Include="System.Reactive" />
</ItemGroup>

<Import Project="..\..\build\SignAssembly.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BindTagToVisualRootDataContextBehavior : Behavior<Control>
protected override void OnAttachedToVisualTree()
{
var visualRoot = (Control?)AssociatedObject?.GetVisualRoot();
if (visualRoot is { })
if (visualRoot is not null)
{
_disposable = BindDataContextToTag(visualRoot, AssociatedObject);
}
Expand All @@ -37,6 +37,6 @@ protected override void OnDetachedFromVisualTree()
throw new ArgumentNullException(nameof(target));

var data = source.GetObservable(StyledElement.DataContextProperty);
return data is { } ? target.Bind(Control.TagProperty, data) : null;
return data is not null ? target.Bind(Control.TagProperty, data) : null;
}
}
Loading

0 comments on commit 62b1eb4

Please sign in to comment.