diff --git a/Documentation/build.md b/Documentation/build.md
index 2f59146a48..5f75290424 100644
--- a/Documentation/build.md
+++ b/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
diff --git a/NuGet.Config b/NuGet.Config
index 3abd236d42..7a1f28bea7 100644
--- a/NuGet.Config
+++ b/NuGet.Config
@@ -4,6 +4,6 @@
-
+
diff --git a/build/ApiDiff.props b/build/ApiDiff.props
index 3d322f56d5..fb65ef6e87 100644
--- a/build/ApiDiff.props
+++ b/build/ApiDiff.props
@@ -1,6 +1,6 @@
- 0.10.0-preview3
+ 0.10.0-preview6
$(PackageId)
Avalonia
diff --git a/build/MicroCom.targets b/build/MicroCom.targets
index 3a07950616..b48e377fd4 100644
--- a/build/MicroCom.targets
+++ b/build/MicroCom.targets
@@ -2,7 +2,7 @@
-
+
false
all
true
@@ -12,10 +12,10 @@
-
+
@@ -24,7 +24,7 @@
-
+
<_AvaloniaPatchComInterop>true
diff --git a/build/Rx.props b/build/Rx.props
index 8a15ccd6a9..fde1f80ea1 100644
--- a/build/Rx.props
+++ b/build/Rx.props
@@ -1,5 +1,5 @@
-
+
diff --git a/native/Avalonia.Native/src/OSX/platformthreading.mm b/native/Avalonia.Native/src/OSX/platformthreading.mm
index f93436d157..e83bf53331 100644
--- a/native/Avalonia.Native/src/OSX/platformthreading.mm
+++ b/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
{
diff --git a/native/Avalonia.Native/src/OSX/rendertarget.mm b/native/Avalonia.Native/src/OSX/rendertarget.mm
index 93a33bbbb0..00b6dab219 100644
--- a/native/Avalonia.Native/src/OSX/rendertarget.mm
+++ b/native/Avalonia.Native/src/OSX/rendertarget.mm
@@ -2,6 +2,7 @@
#include "rendertarget.h"
#import
#import
+#import
#include
#include
@@ -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
diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs
index 97647a1c59..8e331edab4 100644
--- a/nukebuild/Build.cs
+++ b/nukebuild/Build.cs
@@ -107,7 +107,7 @@ partial class Build : NukeBuild
.AddProperty("JavaSdkDirectory", GetVariable("JAVA_HOME_8_X64")))
.AddProperty("PackageVersion", Parameters.Version)
.AddProperty("iOSRoslynPathHackRequired", true)
- .SetToolPath(MsBuildExe.Value)
+ .SetProcessToolPath(MsBuildExe.Value)
.SetConfiguration(Parameters.Configuration)
.SetVerbosity(MSBuildVerbosity.Minimal)
.Apply(configurator));
@@ -132,10 +132,10 @@ partial class Build : NukeBuild
var webappDir = RootDirectory / "src" / "Avalonia.DesignerSupport" / "Remote" / "HtmlTransport" / "webapp";
NpmTasks.NpmInstall(c => c
- .SetWorkingDirectory(webappDir)
- .SetArgumentConfigurator(a => a.Add("--silent")));
+ .SetProcessWorkingDirectory(webappDir)
+ .SetProcessArgumentConfigurator(a => a.Add("--silent")));
NpmTasks.NpmRun(c => c
- .SetWorkingDirectory(webappDir)
+ .SetProcessWorkingDirectory(webappDir)
.SetCommand("dist"));
});
@@ -157,7 +157,7 @@ partial class Build : NukeBuild
{
if (Parameters.IsRunningOnWindows)
MsBuildCommon(Parameters.MSBuildSolution, c => c
- .SetArgumentConfigurator(a => a.Add("/r"))
+ .SetProcessArgumentConfigurator(a => a.Add("/r"))
.AddTargets("Build")
);
@@ -194,7 +194,7 @@ partial class Build : NukeBuild
var eventsProject = Path.Combine(eventsDirectory, "Avalonia.ReactiveUI.Events.csproj");
if (Parameters.IsRunningOnWindows)
MsBuildCommon(eventsProject, c => c
- .SetArgumentConfigurator(a => a.Add("/r"))
+ .SetProcessArgumentConfigurator(a => a.Add("/r"))
.AddTargets("Build")
);
else
@@ -242,10 +242,10 @@ partial class Build : NukeBuild
var webappTestDir = RootDirectory / "tests" / "Avalonia.DesignerSupport.Tests" / "Remote" / "HtmlTransport" / "webapp";
NpmTasks.NpmInstall(c => c
- .SetWorkingDirectory(webappTestDir)
- .SetArgumentConfigurator(a => a.Add("--silent")));
+ .SetProcessWorkingDirectory(webappTestDir)
+ .SetProcessArgumentConfigurator(a => a.Add("--silent")));
NpmTasks.NpmRun(c => c
- .SetWorkingDirectory(webappTestDir)
+ .SetProcessWorkingDirectory(webappTestDir)
.SetCommand("test"));
});
diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj
index 745c727be2..b0380cc92b 100644
--- a/nukebuild/_build.csproj
+++ b/nukebuild/_build.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/samples/ControlCatalog/DecoratedWindow.xaml b/samples/ControlCatalog/DecoratedWindow.xaml
index 8e4c97b7f0..5251a2fa55 100644
--- a/samples/ControlCatalog/DecoratedWindow.xaml
+++ b/samples/ControlCatalog/DecoratedWindow.xaml
@@ -6,25 +6,21 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml
index 97bd88f5e4..6a70bb082f 100644
--- a/samples/ControlCatalog/MainWindow.xaml
+++ b/samples/ControlCatalog/MainWindow.xaml
@@ -16,47 +16,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/samples/ControlCatalog/Pages/DialogsPage.xaml.cs b/samples/ControlCatalog/Pages/DialogsPage.xaml.cs
index cf6c771e34..49921fb7f6 100644
--- a/samples/ControlCatalog/Pages/DialogsPage.xaml.cs
+++ b/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;
}
diff --git a/samples/Sandbox/MainWindow.axaml.cs b/samples/Sandbox/MainWindow.axaml.cs
index b7222e043d..3d54036d29 100644
--- a/samples/Sandbox/MainWindow.axaml.cs
+++ b/samples/Sandbox/MainWindow.axaml.cs
@@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
+using Avalonia.Win32.WinRT.Composition;
namespace Sandbox
{
diff --git a/src/Avalonia.Base/Data/Core/TypeCastNode.cs b/src/Avalonia.Base/Data/Core/TypeCastNode.cs
new file mode 100644
index 0000000000..476fd5527f
--- /dev/null
+++ b/src/Avalonia.Base/Data/Core/TypeCastNode.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Avalonia.Data.Core
+{
+ public class TypeCastNode : ExpressionNode
+ {
+ public override string Description => $"as {TargetType.FullName}";
+
+ public Type TargetType { get; }
+
+ public TypeCastNode(Type type)
+ {
+ TargetType = type;
+ }
+
+ protected virtual object Cast(object value)
+ {
+ return TargetType.IsInstanceOfType(value) ? value : null;
+ }
+
+ protected override void StartListeningCore(WeakReference