Browse Source

Merge branch 'master' into binding-updates2

Conflicts:
	src/Avalonia.Controls/TextBox.cs
	tests/Avalonia.Controls.UnitTests/TextBoxTests.cs
pull/691/head
Steven Kirk 10 years ago
parent
commit
80a6ccd97d
  1. 13
      .travis.yml
  2. 1365
      Avalonia.mono.sln
  3. 334
      Avalonia.sln
  4. 90
      docs/guidelines/build.md
  5. BIN
      docs/images/add-dialogs.png
  6. 62
      docs/spec/styles.md
  7. 11
      docs/tutorial/gettingstarted.md
  8. BIN
      docs/tutorial/images/add-dialogs.png
  9. BIN
      docs/tutorial/images/add-packages.png
  10. 2
      nuget/build-appveyor.ps1
  11. 2
      nuget/build.ps1
  12. 1
      nuget/template/Avalonia.Android.nuspec
  13. 2
      nuget/template/Avalonia.Skia.Desktop.nuspec
  14. 2
      readme.md
  15. 4
      samples/BindingTest/App.config
  16. 12
      samples/BindingTest/BindingTest.csproj
  17. 10
      samples/ControlCatalog.Desktop/App.config
  18. 9
      samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
  19. 92
      samples/ControlCatalog.Desktop/Program.cs
  20. BIN
      samples/ControlCatalog/Assets/test_icon.ico
  21. 13
      samples/ControlCatalog/ControlCatalog.csproj
  22. 5
      samples/ControlCatalog/MainWindow.xaml
  23. 19
      samples/ControlCatalog/Pages/TreeViewPage.xaml
  24. 37
      samples/ControlCatalog/Pages/TreeViewPage.xaml.cs
  25. 12
      samples/TestApplication/App.config
  26. 4
      samples/TestApplication/TestApplication.csproj
  27. 14
      samples/VirtualizationTest/App.config
  28. 15
      samples/VirtualizationTest/VirtualizationTest.csproj
  29. 12
      samples/XamlTestApplication/App.config
  30. 4
      samples/XamlTestApplication/XamlTestApplication.csproj
  31. 18
      src/Android/Avalonia.Android/AndroidPlatform.cs
  32. 5
      src/Android/Avalonia.Android/Platform/SkiaPlatform/WindowImpl.cs
  33. 1
      src/Avalonia.Base/Avalonia.Base.csproj
  34. 15
      src/Avalonia.Base/app.config
  35. 4
      src/Avalonia.Controls/Avalonia.Controls.csproj
  36. 15
      src/Avalonia.Controls/DropDown.cs
  37. 4
      src/Avalonia.Controls/Generators/ItemContainerEventArgs.cs
  38. 11
      src/Avalonia.Controls/Generators/ItemContainerGenerator.cs
  39. 8
      src/Avalonia.Controls/Generators/TreeContainerIndex.cs
  40. 7
      src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs
  41. 6
      src/Avalonia.Controls/ItemsControl.cs
  42. 3
      src/Avalonia.Controls/ListBox.cs
  43. 17
      src/Avalonia.Controls/Platform/IPlatformIconLoader.cs
  44. 14
      src/Avalonia.Controls/Platform/ITopLevelRenderer.cs
  45. 9
      src/Avalonia.Controls/Platform/IWindowIconImpl.cs
  46. 5
      src/Avalonia.Controls/Platform/IWindowImpl.cs
  47. 8
      src/Avalonia.Controls/Presenters/ItemVirtualizer.cs
  48. 4
      src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs
  49. 2
      src/Avalonia.Controls/Presenters/ItemsPresenter.cs
  50. 8
      src/Avalonia.Controls/Primitives/AdornerLayer.cs
  51. 105
      src/Avalonia.Controls/TextBox.cs
  52. 2
      src/Avalonia.Controls/Utils/IEnumerableUtils.cs
  53. 6
      src/Avalonia.Controls/Utils/StringUtils.cs
  54. 4
      src/Avalonia.Controls/Utils/UndoRedoHelper.cs
  55. 1
      src/Avalonia.Controls/VirtualizingStackPanel.cs
  56. 16
      src/Avalonia.Controls/Window.cs
  57. 34
      src/Avalonia.Controls/WindowIcon.cs
  58. 19
      src/Avalonia.Controls/app.config
  59. 1
      src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj
  60. 15
      src/Avalonia.DesignerSupport/app.config
  61. 1
      src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj
  62. 15
      src/Avalonia.Diagnostics/app.config
  63. 1
      src/Avalonia.Input/Avalonia.Input.csproj
  64. 19
      src/Avalonia.Input/app.config
  65. 1
      src/Avalonia.Interactivity/Avalonia.Interactivity.csproj
  66. 15
      src/Avalonia.Interactivity/app.config
  67. 1
      src/Avalonia.Layout/Avalonia.Layout.csproj
  68. 15
      src/Avalonia.Layout/app.config
  69. 2
      src/Avalonia.SceneGraph/Avalonia.SceneGraph.csproj
  70. 6
      src/Avalonia.SceneGraph/Media/Imaging/Bitmap.cs
  71. 7
      src/Avalonia.SceneGraph/Media/Imaging/IBitmap.cs
  72. 8
      src/Avalonia.SceneGraph/Platform/IBitmapImpl.cs
  73. 30
      src/Avalonia.SceneGraph/RenderTargetCorruptedException.cs
  74. 17
      src/Avalonia.SceneGraph/Rendering/RendererMixin.cs
  75. 26
      src/Avalonia.SceneGraph/VisualTree/BoundsTracker.cs
  76. 2
      src/Avalonia.SceneGraph/VisualTree/VisualExtensions.cs
  77. 15
      src/Avalonia.SceneGraph/app.config
  78. 1
      src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj
  79. 17
      src/Avalonia.Themes.Default/DropDown.xaml
  80. 6
      src/Avalonia.Themes.Default/Expander.xaml
  81. 15
      src/Avalonia.Themes.Default/app.config
  82. 38
      src/Gtk/Avalonia.Cairo/Media/DrawingContext.cs
  83. 20
      src/Gtk/Avalonia.Cairo/Media/Imaging/BitmapImpl.cs
  84. 11
      src/Gtk/Avalonia.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs
  85. 11
      src/Gtk/Avalonia.Cairo/Media/StreamGeometryContextImpl.cs
  86. 1
      src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj
  87. 32
      src/Gtk/Avalonia.Gtk/GtkPlatform.cs
  88. 20
      src/Gtk/Avalonia.Gtk/IconImpl.cs
  89. 37
      src/Gtk/Avalonia.Gtk/WindowImpl.cs
  90. 4
      src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj
  91. 1
      src/Markup/Avalonia.Markup.Xaml/Context/AvaloniaTypeFeatureProvider.cs
  92. 70
      src/Markup/Avalonia.Markup.Xaml/Converters/IconTypeConverter.cs
  93. 86
      src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/Standard/StaticExtension.cs
  94. 49
      src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/Standard/TypeExtension.cs
  95. 1
      src/Markup/Avalonia.Markup.Xaml/Properties/AssemblyInfo.cs
  96. 11
      src/Markup/Avalonia.Markup.Xaml/app.config
  97. 8
      src/Shared/SharedAssemblyInfo.cs
  98. 4
      src/Skia/Avalonia.Skia.Android/Avalonia.Skia.Android.csproj
  99. 2
      src/Skia/Avalonia.Skia.Android/packages.config
  100. 8
      src/Skia/Avalonia.Skia.Desktop/Avalonia.Skia.Desktop.csproj

13
.travis.yml

@ -4,22 +4,17 @@ os:
- osx - osx
mono: mono:
- latest - latest
solution: Avalonia.mono.sln solution: Avalonia.travis-mono.sln
before_install: before_install:
- mkdir -p .nuget - mkdir -p .nuget
- wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
install: install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y gtk-sharp2 ; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y gtk-sharp2 ; fi
- mono .nuget/nuget.exe restore Avalonia.mono.sln - mono .nuget/nuget.exe restore Avalonia.sln
- mono .nuget/nuget.exe install xunit.runner.console -Version 2.1.0 -OutputDirectory testrunner - mono .nuget/nuget.exe install xunit.runner.console -Version 2.1.0 -OutputDirectory testrunner
script: script:
- xbuild /p:Configuration=Release Avalonia.mono.sln - xbuild /p:Platform=Mono /p:Configuration=Release Avalonia.sln
- mono ./testrunner/xunit.runner.console.2.1.0/tools/xunit.console.exe ./tests/Avalonia.Base.UnitTests/bin/Release/Avalonia.Base.UnitTests.dll - ./tests/run-tests.sh
- mono ./testrunner/xunit.runner.console.2.1.0/tools/xunit.console.exe ./tests/Avalonia.Input.UnitTests/bin/Release/Avalonia.Input.UnitTests.dll
- mono ./testrunner/xunit.runner.console.2.1.0/tools/xunit.console.exe ./tests/Avalonia.Interactivity.UnitTests/bin/Release/Avalonia.Interactivity.UnitTests.dll
- mono ./testrunner/xunit.runner.console.2.1.0/tools/xunit.console.exe ./tests/Avalonia.Layout.UnitTests/bin/Release/Avalonia.Layout.UnitTests.dll
- mono ./testrunner/xunit.runner.console.2.1.0/tools/xunit.console.exe ./tests/Avalonia.Markup.UnitTests/bin/Release/Avalonia.Markup.UnitTests.dll
- mono ./testrunner/xunit.runner.console.2.1.0/tools/xunit.console.exe ./tests/Avalonia.Styling.UnitTests/bin/Release/Avalonia.Styling.UnitTests.dll
notifications: notifications:
email: false email: false
webhooks: webhooks:

1365
Avalonia.mono.sln

File diff suppressed because it is too large

334
Avalonia.sln

File diff suppressed because it is too large

90
docs/guidelines/build.md

@ -1,55 +1,89 @@
# Building Avalonia # Building Avalonia
## Windows ## Windows
Avalonia requires Visual Studio 2015 to build on Windows. Avalonia requires at least Visual Studio 2015 to build on Windows.
### Install GTK Sharp ### Install GTK Sharp
For the moment under windows, you must have [gtk-sharp](http://www.mono-project.com/download/#download-win) installed. Note that after installing the package your machine may require a restart before GTK# is added to your path. We hope to remove or make this dependency optional at some point in the future. For the moment under windows, you must have [gtk-sharp](http://www.mono-project.com/download/#download-win)
installed. Note that after installing the package your machine may require a restart before GTK# is
added to your path. We hope to remove or make this dependency optional at some point in the future.
### Clone the Avalonia repository ### Clone the Avalonia repository
git clone https://github.com/AvaloniaUI/Avalonia.git ```
git clone https://github.com/AvaloniaUI/Avalonia.git
git submodule update --init
```
We currently need to build our own private version of some libraries. These are linked as submodules in the git repository, so run: ### Open in Visual Studio
Open the `Avalonia.sln` solution in Visual Studio 2015 or newer. The free Visual Studio Community
edition works fine. Run the `Samples\ControlCatalog.Desktop` project to see the sample application.
git submodule update --init
## Linux ## Linux
This guide Written for Ubuntu 15.04 - I'm not sure how well it applies to other distributions, but ### Install the latest version of Mono
please submit a PR if you have anything to add.
To build Avalonia under Linux, you need to have a recent version of Mono installed. Mono is a cross-
platform, open source .Net platform. There is a very good chance that the version of Mono that came
with your Linux distribution is too old, so you want to install a more up-to-date version. The most
convenient way to to this is through your package manager. The Mono project has great [installation
instructions for many popular Linux distros](http://www.mono-project.com/docs/getting-started/install/linux).
### Install Latest Mono This will make the most up-to-date Mono release available through your package manager, and offer
you updates as they become available.
That the time of writing, mono 4.2 aplha was needed to build. Add mono package sources by following Once you have your package manager configured for the Mono repository, install the `mono-devel`
instructions below for the stable channel and then add the alpha channel as well. package, for example on ubuntu:
http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives ```
sudo apt-get install mono-devel
```
Then install the needed packages: Once installed, check the version of mono to ensure it's at least 4.4.2:
sudo apt-get install git mono-devel referenceassemblies-pcl monodevelop ```
mono --version
```
### Clone the Avalonia repository ### Clone the Avalonia repository
git clone https://github.com/AvaloniaUI/Avalonia.git ```
git clone https://github.com/AvaloniaUI/Avalonia.git
git submodule update --init
```
### Restore nuget packages
```
cd Avalonia
mkdir -p .nuget
wget -O .nuget/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
mono .nuget/nuget.exe restore Avalonia.sln
```
### Build and Run Avalonia
To build Avalonia in the `Debug` configuration:
We currently need to build our own private version of ReactiveUI as it doesn't work on mono. This ```
is linked as a submodule in the git repository, so run: xbuild /p:Platform=Mono /p:Configuration=Debug Avalonia.sln
```
git submodule update --init You should now be able to run the ControlCatalog.Desktop sample:
The next step is to download the Skia native libraries. Run ```getnatives.sh``` script which can be found under the folder ```src\Skia\```.
### Load the Project in MonoDevelop
Start MonoDevelop and open the `Avalonia.sln` solution. Wait for MonoDevelop to install the ```
project's NuGet packages. mono ./samples/ControlCatalog.Desktop/bin/Debug/ControlCatalog.Desktop.exe
```
Set the TestApplication project as the startup project and click Run. ### Building Avalonia in MonoDevelop
There will be some compile errors in the tests, but ignore them for now. Unless you have a very current version of monodevelop (6.1.x or newer), it is necessary to manually
restore the Nuget depdendencies as [mentioned above](#restore-nuget-packages). You must then
disable MonoDevelop's inbuilt NuGet package manager add-in by going to `Tools -> Add-in Manager` or
it will complain that a newer version of NuGet is needed.
You can track the Linux version's progress in the [Linux issue](https://github.com/AvaloniaUI/Avalonia/issues/78). Finally, select the `Debug | Mono` or `Release | Mono` build configuration and you should be good to
go!

BIN
docs/images/add-dialogs.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

62
docs/spec/styles.md

@ -20,14 +20,16 @@ for the rest of this document we'll refer to existing XAML toolkit's styling as
Make all `Button`s in a `StackPanel` have a blue `Background`: Make all `Button`s in a `StackPanel` have a blue `Background`:
<StackPanel> ```xaml
<StackPanel.Styles> <StackPanel>
<Style Selector="Button"> <StackPanel.Styles>
<Setter Property="Button.Background" Value="Blue"/> <Style Selector="Button">
</Style> <Setter Property="Button.Background" Value="Blue"/>
</StackPanel.Styles> </Style>
<Button>I will have a blue background.</Button> </StackPanel.Styles>
</StackPanel> <Button>I will have a blue background.</Button>
</StackPanel>
```
This is very similar to WPF, except `TargetType` is replaced by `Selector`. This is very similar to WPF, except `TargetType` is replaced by `Selector`.
@ -39,15 +41,17 @@ qualified property name (i.e. `Button.Background` instead of simply
As in CSS, controls can be given *style classes* which can be used in selectors: As in CSS, controls can be given *style classes* which can be used in selectors:
<StackPanel> ```xaml
<StackPanel.Styles> <StackPanel>
<Style Selector="Button.blue"> <StackPanel.Styles>
<Setter Property="Button.Background" Value="Blue"/> <Style Selector="Button.blue">
</Style> <Setter Property="Button.Background" Value="Blue"/>
</StackPanel.Styles> </Style>
<Button Classes="blue">I will have a blue background.</Button> </StackPanel.Styles>
<Button>I will not.</Button> <Button Classes="blue">I will have a blue background.</Button>
</StackPanel> <Button>I will not.</Button>
</StackPanel>
```
Each control can be given 0 or more style classes. This is different to WPF Each control can be given 0 or more style classes. This is different to WPF
where only a single style can be applied to a control: in Avalonia any number where only a single style can be applied to a control: in Avalonia any number
@ -56,8 +60,10 @@ a particular property, the style closest to the control will take precedence.
Style classes can also be manipulated in code using the `Classes` collection: Style classes can also be manipulated in code using the `Classes` collection:
control.Classes.Add("blue"); ```csharp
control.Classes.Remove("red"); control.Classes.Add("blue");
control.Classes.Remove("red");
```
## Pseudoclasses ## Pseudoclasses
@ -71,14 +77,16 @@ pseudoclass (`:hover` in CSS - we may change to that in future).
Pseudoclasses provide the functionality of `Triggers` in WPF and Pseudoclasses provide the functionality of `Triggers` in WPF and
`VisualStateManager` in UWP: `VisualStateManager` in UWP:
<StackPanel> ```xaml
<StackPanel.Styles> <StackPanel>
<Style Selector="Button:pointerover"> <StackPanel.Styles>
<Setter Property="Button.Foreground" Value="Red"/> <Style Selector="Button:pointerover">
</Style> <Setter Property="Button.Foreground" Value="Red"/>
</StackPanel.Styles> </Style>
<Button>I will have red text when hovered.</Button> </StackPanel.Styles>
</StackPanel> <Button>I will have red text when hovered.</Button>
</StackPanel>
```
Other pseudoclasses include `:focus`, `:disabled`, `:pressed` for buttons, Other pseudoclasses include `:focus`, `:disabled`, `:pressed` for buttons,
`:checked` for checkboxes etc. `:checked` for checkboxes etc.

11
docs/tutorial/gettingstarted.md

@ -4,12 +4,7 @@
![](images/add-dialogs.png) ![](images/add-dialogs.png)
The easiest way to try out Avalonia is to install the Visual Studio Extension. The easiest way to try out Avalonia is to install the [Visual Studio Extension](https://visualstudiogallery.msdn.microsoft.com/e1c6ae1f-6fd9-467d-8f62-1e28b4225213).
This will add a Avalonia project template and a Window template to the standard Visual Studo “Add” dialog (yes, icons still to come :) ): This will add a Avalonia project template and a Window template to the standard Visual Studo “Add”
dialog (yes, icons still to come :) ):
## OSX / Linux
It is a little more manual on non-Windows platforms, but using Xamarin Studio you can install the Avalonia NuGet package.
![](images/add-packages.png)

BIN
docs/tutorial/images/add-dialogs.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 45 KiB

BIN
docs/tutorial/images/add-packages.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

2
nuget/build-appveyor.ps1

@ -7,7 +7,7 @@ Push-Location $dir
sv version $env:APPVEYOR_BUILD_NUMBER sv version $env:APPVEYOR_BUILD_NUMBER
#sv version "1-debug" #sv version "1-debug"
sv version 0.2.0.$version-alpha sv version 0.4.1-build$version-alpha
sv key $env:myget_key sv key $env:myget_key
. ".\include.ps1" . ".\include.ps1"

2
nuget/build.ps1

@ -1 +1 @@
.\build-version.ps1 0.2.0-alpha3 .\build-version.ps1 0.4.1

1
nuget/template/Avalonia.Android.nuspec

@ -21,6 +21,7 @@
<dependency id="System.Reactive.Interfaces" version="3.0.0" /> <dependency id="System.Reactive.Interfaces" version="3.0.0" />
<dependency id="System.Reactive.Linq" version="3.0.0" /> <dependency id="System.Reactive.Linq" version="3.0.0" />
<dependency id="System.Reactive.PlatformServices" version="3.0.0" /> <dependency id="System.Reactive.PlatformServices" version="3.0.0" />
<dependency id="SkiaSharp" version="1.53.0"/>
<dependency id="Avalonia" version="#VERSION#" /> <dependency id="Avalonia" version="#VERSION#" />
</dependencies> </dependencies>
</metadata> </metadata>

2
nuget/template/Avalonia.Skia.Desktop.nuspec

@ -13,7 +13,7 @@
<copyright>Copyright 2015</copyright> <copyright>Copyright 2015</copyright>
<tags>Avalonia</tags> <tags>Avalonia</tags>
<dependencies> <dependencies>
<dependency id="SkiaSharp" version="1.49.4.0-beta"/> <dependency id="SkiaSharp" version="1.53.0"/>
<dependency id="Avalonia" version="#VERSION#" /> <dependency id="Avalonia" version="#VERSION#" />
</dependencies> </dependencies>
</metadata> </metadata>

2
readme.md

@ -35,7 +35,7 @@ using Direct2D and other operating systems using Gtk & Cairo.
Avalonia is now in alpha. What does "alpha" mean? Well, it means that it's now at a stage where you Avalonia is now in alpha. What does "alpha" mean? Well, it means that it's now at a stage where you
can have a play and hopefully create simple applications. There's now a [Visual can have a play and hopefully create simple applications. There's now a [Visual
Studio Extension](https://visualstudiogallery.msdn.microsoft.com/a4542e8a-b56c-4295-8df1-7e220178b873) Studio Extension](https://visualstudiogallery.msdn.microsoft.com/e1c6ae1f-6fd9-467d-8f62-1e28b4225213)
containing project and item templates that will help you get started, and containing project and item templates that will help you get started, and
there's an initial complement of controls. There's still a lot missing, and you there's an initial complement of controls. There's still a lot missing, and you
*will* find bugs, and the API *will* change, but this represents the first time *will* find bugs, and the API *will* change, but this represents the first time

4
samples/BindingTest/App.config

@ -13,6 +13,10 @@
<assemblyIdentity name="SharpDX.DXGI" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" /> <assemblyIdentity name="SharpDX.DXGI" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.2.0" newVersion="3.0.2.0" /> <bindingRedirect oldVersion="0.0.0.0-3.0.2.0" newVersion="3.0.2.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

12
samples/BindingTest/BindingTest.csproj

@ -156,14 +156,22 @@
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> <Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project>
<Name>Avalonia.Themes.Default</Name> <Name>Avalonia.Themes.Default</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> <Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project>
<Name>Avalonia.Direct2D1</Name> <Name>Avalonia.Direct2D1</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> <Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
<Name>Avalonia.Win32</Name> <Name>Avalonia.Win32</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
<Project>{54F237D5-A70A-4752-9656-0C70B1A7B047}</Project>
<Name>Avalonia.Gtk</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
<Project>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</Project>
<Name>Avalonia.Cairo</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

10
samples/ControlCatalog.Desktop/App.config

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" /> <assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

9
samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ControlCatalog.Desktop</RootNamespace> <RootNamespace>ControlCatalog.Desktop</RootNamespace>
<AssemblyName>ControlCatalog.Desktop</AssemblyName> <AssemblyName>ControlCatalog.Desktop</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -119,15 +120,15 @@
<Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project> <Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project>
<Name>Avalonia.Themes.Default</Name> <Name>Avalonia.Themes.Default</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj"> <ProjectReference Include="..\..\src\Skia\Avalonia.Skia.Desktop\Avalonia.Skia.Desktop.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{925DD807-B651-475F-9F7C-CBEB974CE43D}</Project> <Project>{925DD807-B651-475F-9F7C-CBEB974CE43D}</Project>
<Name>Avalonia.Skia.Desktop</Name> <Name>Avalonia.Skia.Desktop</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project> <Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project>
<Name>Avalonia.Direct2D1</Name> <Name>Avalonia.Direct2D1</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project> <Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project>
<Name>Avalonia.Win32</Name> <Name>Avalonia.Win32</Name>
</ProjectReference> </ProjectReference>

92
samples/ControlCatalog.Desktop/Program.cs

@ -39,96 +39,4 @@ namespace ControlCatalog
.SetDefaultAssembly(typeof(App).Assembly); .SetDefaultAssembly(typeof(App).Assembly);
} }
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Experimental: Would like to move this into a shared location once I figure out the best place for it
// considering all common libraries are PCL and do not have access to Environment.OSVersion.Platform
// nor do they have access to the platform specific render/subsystem extensions.
//
// Perhaps via DI we register each system with a priority/rank
//
public static class RenderSystemExtensions
{
[Flags]
enum RenderSystem
{
None = 0,
GTK = 1,
Skia = 2,
Direct2D = 4
};
/// <summary>
/// Default (Optimal) render system for a particular platform
/// </summary>
/// <returns></returns>
private static RenderSystem DefaultRenderSystem()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.MacOSX:
return RenderSystem.GTK;
case PlatformID.Unix:
return RenderSystem.GTK;
case PlatformID.Win32Windows:
return RenderSystem.Direct2D;
}
return RenderSystem.None;
}
/// <summary>
/// Returns an array of avalidable rendering systems in priority order
/// </summary>
/// <returns></returns>
private static RenderSystem[] AvailableRenderSystems()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.MacOSX:
return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia };
case PlatformID.Unix:
return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia };
case PlatformID.Win32Windows:
return new RenderSystem[] { RenderSystem.Direct2D, RenderSystem.Skia, RenderSystem.GTK };
}
return new RenderSystem[0];
}
/// <summary>
/// Selects the optimal render system for desktop platforms. Supports cmd line overrides
/// </summary>
/// <param name="builder"></param>
/// <param name="args"></param>
public static AppBuilder ConfigureRenderSystem(this AppBuilder builder, string[] args)
{
// So this all works great under Windows where it can support
// ALL configurations. But on OSX/Unix we cannot use Direct2D
if (args.Contains("--gtk") || DefaultRenderSystem() == RenderSystem.GTK)
{
builder.UseGtk();
builder.UseCairo();
}
else
{
builder.UseWin32();
if (args.Contains("--skia") || DefaultRenderSystem() == RenderSystem.Skia)
{
builder.UseSkia();
}
else
{
builder.UseDirect2D1();
}
}
return builder;
}
}
} }

BIN
samples/ControlCatalog/Assets/test_icon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

13
samples/ControlCatalog/ControlCatalog.csproj

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
@ -127,6 +127,9 @@
<Compile Include="Pages\SliderPage.xaml.cs"> <Compile Include="Pages\SliderPage.xaml.cs">
<DependentUpon>SliderPage.xaml</DependentUpon> <DependentUpon>SliderPage.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Pages\TreeViewPage.xaml.cs">
<DependentUpon>TreeViewPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\TextBoxPage.xaml.cs"> <Compile Include="Pages\TextBoxPage.xaml.cs">
<DependentUpon>TextBoxPage.xaml</DependentUpon> <DependentUpon>TextBoxPage.xaml</DependentUpon>
</Compile> </Compile>
@ -204,6 +207,14 @@
<Name>Avalonia.Themes.Default</Name> <Name>Avalonia.Themes.Default</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Assets\test_icon.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\TreeViewPage.xaml">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

5
samples/ControlCatalog/MainWindow.xaml

@ -1,6 +1,8 @@
<Window xmlns="https://github.com/avaloniaui" <Window xmlns="https://github.com/avaloniaui"
xmlns:pages="clr-namespace:ControlCatalog.Pages;assembly=ControlCatalog" xmlns:pages="clr-namespace:ControlCatalog.Pages;assembly=ControlCatalog"
Title="Avalonia Control Gallery"> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Avalonia Control Gallery"
Icon="resm:ControlCatalog.Assets.test_icon.ico?assembly=ControlCatalog">
<TabControl Classes="sidebar"> <TabControl Classes="sidebar">
<TabControl.Transition> <TabControl.Transition>
<CrossFade Duration="0.25"/> <CrossFade Duration="0.25"/>
@ -19,5 +21,6 @@
<TabItem Header="Slider"><pages:SliderPage/></TabItem> <TabItem Header="Slider"><pages:SliderPage/></TabItem>
<TabItem Header="TextBox"><pages:TextBoxPage/></TabItem> <TabItem Header="TextBox"><pages:TextBoxPage/></TabItem>
<TabItem Header="ToolTip"><pages:ToolTipPage/></TabItem> <TabItem Header="ToolTip"><pages:ToolTipPage/></TabItem>
<TabItem Header="TreeView"><pages:TreeViewPage/></TabItem>
</TabControl> </TabControl>
</Window> </Window>

19
samples/ControlCatalog/Pages/TreeViewPage.xaml

@ -0,0 +1,19 @@
<UserControl xmlns="https://github.com/avaloniaui">
<StackPanel Orientation="Vertical" Gap="4">
<TextBlock Classes="h1">TreeView</TextBlock>
<TextBlock Classes="h2">Displays a hierachical tree of data.</TextBlock>
<StackPanel Orientation="Horizontal"
Margin="0,16,0,0"
HorizontalAlignment="Center"
Gap="16">
<TreeView Items="{Binding}" Width="250" Height="350">
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Children}">
<TextBlock Text="{Binding Header}"/>
</TreeDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</StackPanel>
</StackPanel>
</UserControl>

37
samples/ControlCatalog/Pages/TreeViewPage.xaml.cs

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace ControlCatalog.Pages
{
public class TreeViewPage : UserControl
{
public TreeViewPage()
{
this.InitializeComponent();
DataContext = CreateNodes(0);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private IList<Node> CreateNodes(int level)
{
return Enumerable.Range(0, 10).Select(x => new Node
{
Header = $"Item {x}",
Children = level < 5 ? CreateNodes(level + 1) : null,
}).ToList();
}
private class Node
{
public string Header { get; set; }
public IList<Node> Children { get; set; }
}
}
}

12
samples/TestApplication/App.config

@ -5,18 +5,6 @@
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" /> <assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />

4
samples/TestApplication/TestApplication.csproj

@ -151,11 +151,11 @@
<Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project> <Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project>
<Name>Avalonia.Themes.Default</Name> <Name>Avalonia.Themes.Default</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project> <Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project>
<Name>Avalonia.Direct2D1</Name> <Name>Avalonia.Direct2D1</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project> <Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project>
<Name>Avalonia.Win32</Name> <Name>Avalonia.Win32</Name>
</ProjectReference> </ProjectReference>

14
samples/VirtualizationTest/App.config

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup> </startup>
</configuration> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

15
samples/VirtualizationTest/VirtualizationTest.csproj

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VirtualizationTest</RootNamespace> <RootNamespace>VirtualizationTest</RootNamespace>
<AssemblyName>VirtualizationTest</AssemblyName> <AssemblyName>VirtualizationTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -142,14 +143,22 @@
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> <Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project>
<Name>Avalonia.Markup</Name> <Name>Avalonia.Markup</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> <Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project>
<Name>Avalonia.Direct2D1</Name> <Name>Avalonia.Direct2D1</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> <Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project>
<Name>Avalonia.Win32</Name> <Name>Avalonia.Win32</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Gtk\Avalonia.Cairo\Avalonia.Cairo.csproj">
<Project>{FB05AC90-89BA-4F2F-A924-F37875FB547C}</Project>
<Name>Avalonia.Cairo</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk\Avalonia.Gtk.csproj">
<Project>{54F237D5-A70A-4752-9656-0C70B1A7B047}</Project>
<Name>Avalonia.Gtk</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="App.xaml"> <EmbeddedResource Include="App.xaml">

12
samples/XamlTestApplication/App.config

@ -5,18 +5,6 @@
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" /> <assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" /> <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />

4
samples/XamlTestApplication/XamlTestApplication.csproj

@ -155,11 +155,11 @@
<Project>{3E53A01A-B331-47F3-B828-4A5717E77A24}</Project> <Project>{3E53A01A-B331-47F3-B828-4A5717E77A24}</Project>
<Name>Avalonia.Markup.Xaml</Name> <Name>Avalonia.Markup.Xaml</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project> <Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project>
<Name>Avalonia.Direct2D1</Name> <Name>Avalonia.Direct2D1</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> <ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'">
<Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project> <Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project>
<Name>Avalonia.Win32</Name> <Name>Avalonia.Win32</Name>
</ProjectReference> </ProjectReference>

18
src/Android/Avalonia.Android/AndroidPlatform.cs

@ -11,10 +11,11 @@ using Avalonia.Skia;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Avalonia.Android.Platform.SkiaPlatform; using Avalonia.Android.Platform.SkiaPlatform;
using System.IO;
namespace Avalonia.Android namespace Avalonia.Android
{ {
public class AndroidPlatform : IPlatformSettings, IWindowingPlatform public class AndroidPlatform : IPlatformSettings, IWindowingPlatform, IPlatformIconLoader
{ {
public static readonly AndroidPlatform Instance = new AndroidPlatform(); public static readonly AndroidPlatform Instance = new AndroidPlatform();
public Size DoubleClickSize => new Size(4, 4); public Size DoubleClickSize => new Size(4, 4);
@ -65,5 +66,20 @@ namespace Avalonia.Android
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public IWindowIconImpl LoadIcon(string fileName)
{
return null;
}
public IWindowIconImpl LoadIcon(Stream stream)
{
return null;
}
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap)
{
return null;
}
} }
} }

5
src/Android/Avalonia.Android/Platform/SkiaPlatform/WindowImpl.cs

@ -180,5 +180,10 @@ namespace Avalonia.Android.Platform.SkiaPlatform
{ {
Paint?.Invoke(new Rect(new Point(0, 0), ClientSize)); Paint?.Invoke(new Rect(new Point(0, 0), ClientSize));
} }
public void SetIcon(IWindowIconImpl icon)
{
// No window icons for mobile platforms
}
} }
} }

1
src/Avalonia.Base/Avalonia.Base.csproj

@ -146,7 +146,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

15
src/Avalonia.Base/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

4
src/Avalonia.Controls/Avalonia.Controls.csproj

@ -56,6 +56,7 @@
<Compile Include="HotkeyManager.cs" /> <Compile Include="HotkeyManager.cs" />
<Compile Include="IApplicationLifecycle.cs" /> <Compile Include="IApplicationLifecycle.cs" />
<Compile Include="IScrollable.cs" /> <Compile Include="IScrollable.cs" />
<Compile Include="WindowIcon.cs" />
<Compile Include="IPseudoClasses.cs" /> <Compile Include="IPseudoClasses.cs" />
<Compile Include="DropDownItem.cs" /> <Compile Include="DropDownItem.cs" />
<Compile Include="ISetInheritanceParent.cs" /> <Compile Include="ISetInheritanceParent.cs" />
@ -64,6 +65,8 @@
<Compile Include="IVirtualizingPanel.cs" /> <Compile Include="IVirtualizingPanel.cs" />
<Compile Include="LayoutTransformControl.cs" /> <Compile Include="LayoutTransformControl.cs" />
<Compile Include="Mixins\ContentControlMixin.cs" /> <Compile Include="Mixins\ContentControlMixin.cs" />
<Compile Include="Platform\IWindowIconImpl.cs" />
<Compile Include="Platform\IPlatformIconLoader.cs" />
<Compile Include="Platform\ITopLevelRenderer.cs" /> <Compile Include="Platform\ITopLevelRenderer.cs" />
<Compile Include="Platform\IWindowingPlatform.cs" /> <Compile Include="Platform\IWindowingPlatform.cs" />
<Compile Include="Platform\PlatformManager.cs" /> <Compile Include="Platform\PlatformManager.cs" />
@ -225,7 +228,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

15
src/Avalonia.Controls/DropDown.cs

@ -28,6 +28,12 @@ namespace Avalonia.Controls
o => o.IsDropDownOpen, o => o.IsDropDownOpen,
(o, v) => o.IsDropDownOpen = v); (o, v) => o.IsDropDownOpen = v);
/// <summary>
/// Defines the <see cref="MaxDropDownHeight"/> property.
/// </summary>
public static readonly StyledProperty<double> MaxDropDownHeightProperty =
AvaloniaProperty.Register<DropDown, double>(nameof(MaxDropDownHeight), 200);
/// <summary> /// <summary>
/// Defines the <see cref="SelectionBoxItem"/> property. /// Defines the <see cref="SelectionBoxItem"/> property.
/// </summary> /// </summary>
@ -56,6 +62,15 @@ namespace Avalonia.Controls
set { SetAndRaise(IsDropDownOpenProperty, ref _isDropDownOpen, value); } set { SetAndRaise(IsDropDownOpenProperty, ref _isDropDownOpen, value); }
} }
/// <summary>
/// Gets or sets the maximum height for the dropdown list.
/// </summary>
public double MaxDropDownHeight
{
get { return GetValue(MaxDropDownHeightProperty); }
set { SetValue(MaxDropDownHeightProperty, value); }
}
/// <summary> /// <summary>
/// Gets or sets the item to display as the control's content. /// Gets or sets the item to display as the control's content.
/// </summary> /// </summary>

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

@ -27,6 +27,10 @@ namespace Avalonia.Controls.Generators
/// </summary> /// </summary>
/// <param name="startingIndex">The index of the first container in the source items.</param> /// <param name="startingIndex">The index of the first container in the source items.</param>
/// <param name="containers">The containers.</param> /// <param name="containers">The containers.</param>
/// <remarks>
/// TODO: Do we really need to pass in StartingIndex here? The ItemContainerInfo objects
/// have an index, and what happens if the contains passed in aren't sequential?
/// </remarks>
public ItemContainerEventArgs( public ItemContainerEventArgs(
int startingIndex, int startingIndex,
IList<ItemContainerInfo> containers) IList<ItemContainerInfo> containers)

11
src/Avalonia.Controls/Generators/ItemContainerGenerator.cs

@ -86,13 +86,15 @@ namespace Avalonia.Controls.Generators
{ {
if (count > 0) if (count > 0)
{ {
var toMove = _containers.Where(x => x.Key >= index).ToList(); var toMove = _containers.Where(x => x.Key >= index)
.OrderByDescending(x => x.Key)
.ToList();
foreach (var i in toMove) foreach (var i in toMove)
{ {
_containers.Remove(i.Key); _containers.Remove(i.Key);
i.Value.Index += count; i.Value.Index += count;
_containers[i.Value.Index] = i.Value; _containers.Add(i.Value.Index, i.Value);
} }
} }
} }
@ -116,7 +118,8 @@ namespace Avalonia.Controls.Generators
_containers.Remove(i); _containers.Remove(i);
} }
var toMove = _containers.Where(x => x.Key >= startingIndex).ToList(); var toMove = _containers.Where(x => x.Key >= startingIndex)
.OrderBy(x => x.Key).ToList();
foreach (var i in toMove) foreach (var i in toMove)
{ {
@ -228,7 +231,7 @@ namespace Avalonia.Controls.Generators
/// <returns>The containers.</returns> /// <returns>The containers.</returns>
protected IEnumerable<ItemContainerInfo> GetContainerRange(int index, int count) protected IEnumerable<ItemContainerInfo> GetContainerRange(int index, int count)
{ {
return _containers.Where(x => x.Key >= index && x.Key <= index + count).Select(x => x.Value); return _containers.Where(x => x.Key >= index && x.Key < index + count).Select(x => x.Value);
} }
/// <summary> /// <summary>

8
src/Avalonia.Controls/Generators/TreeContainerIndex.cs

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Avalonia.Controls.Generators namespace Avalonia.Controls.Generators
{ {
@ -68,8 +69,9 @@ namespace Avalonia.Controls.Generators
/// <summary> /// <summary>
/// Removes a set of containers from the index. /// Removes a set of containers from the index.
/// </summary> /// </summary>
/// <param name="startingIndex">The index of the first item.</param>
/// <param name="containers">The item containers.</param> /// <param name="containers">The item containers.</param>
public void Remove(IEnumerable<ItemContainerInfo> containers) public void Remove(int startingIndex, IEnumerable<ItemContainerInfo> containers)
{ {
foreach (var container in containers) foreach (var container in containers)
{ {
@ -77,6 +79,10 @@ namespace Avalonia.Controls.Generators
_containerToItem.Remove(container.ContainerControl); _containerToItem.Remove(container.ContainerControl);
_itemToContainer.Remove(item); _itemToContainer.Remove(item);
} }
Dematerialized?.Invoke(
this,
new ItemContainerEventArgs(startingIndex, containers.ToList()));
} }
/// <summary> /// <summary>

7
src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls.Templates; using Avalonia.Controls.Templates;
using Avalonia.Data; using Avalonia.Data;
@ -102,19 +103,19 @@ namespace Avalonia.Controls.Generators
public override IEnumerable<ItemContainerInfo> Clear() public override IEnumerable<ItemContainerInfo> Clear()
{ {
var items = base.Clear(); var items = base.Clear();
Index.Remove(items); Index.Remove(0, items);
return items; return items;
} }
public override IEnumerable<ItemContainerInfo> Dematerialize(int startingIndex, int count) public override IEnumerable<ItemContainerInfo> Dematerialize(int startingIndex, int count)
{ {
Index.Remove(GetContainerRange(startingIndex, count)); Index.Remove(startingIndex, GetContainerRange(startingIndex, count));
return base.Dematerialize(startingIndex, count); return base.Dematerialize(startingIndex, count);
} }
public override IEnumerable<ItemContainerInfo> RemoveRange(int startingIndex, int count) public override IEnumerable<ItemContainerInfo> RemoveRange(int startingIndex, int count)
{ {
Index.Remove(GetContainerRange(startingIndex, count)); Index.Remove(startingIndex, GetContainerRange(startingIndex, count));
return base.RemoveRange(startingIndex, count); return base.RemoveRange(startingIndex, count);
} }

6
src/Avalonia.Controls/ItemsControl.cs

@ -157,11 +157,9 @@ namespace Avalonia.Controls
/// <returns>The index of the item or -1 if the item was not found.</returns> /// <returns>The index of the item or -1 if the item was not found.</returns>
protected static object ElementAt(IEnumerable items, int index) protected static object ElementAt(IEnumerable items, int index)
{ {
var typedItems = items?.Cast<object>(); if (index != -1 && index < items.Count())
if (index != -1 && typedItems != null && index < typedItems.Count())
{ {
return typedItems.ElementAt(index) ?? null; return items.ElementAt(index) ?? null;
} }
else else
{ {

3
src/Avalonia.Controls/ListBox.cs

@ -42,7 +42,7 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Defines the <see cref="VirtualizationMode"/> property. /// Defines the <see cref="VirtualizationMode"/> property.
/// </summary> /// </summary>
public static readonly AvaloniaProperty<ItemVirtualizationMode> VirtualizationModeProperty = public static readonly StyledProperty<ItemVirtualizationMode> VirtualizationModeProperty =
ItemsPresenter.VirtualizationModeProperty.AddOwner<ListBox>(); ItemsPresenter.VirtualizationModeProperty.AddOwner<ListBox>();
private IScrollable _scroll; private IScrollable _scroll;
@ -53,6 +53,7 @@ namespace Avalonia.Controls
static ListBox() static ListBox()
{ {
ItemsPanelProperty.OverrideDefaultValue<ListBox>(DefaultPanel); ItemsPanelProperty.OverrideDefaultValue<ListBox>(DefaultPanel);
VirtualizationModeProperty.OverrideDefaultValue<ListBox>(ItemVirtualizationMode.Simple);
} }
/// <summary> /// <summary>

17
src/Avalonia.Controls/Platform/IPlatformIconLoader.cs

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Media.Imaging;
namespace Avalonia.Platform
{
public interface IPlatformIconLoader
{
IWindowIconImpl LoadIcon(string fileName);
IWindowIconImpl LoadIcon(Stream stream);
IWindowIconImpl LoadIcon(IBitmapImpl bitmap);
}
}

14
src/Avalonia.Controls/Platform/ITopLevelRenderer.cs

@ -38,7 +38,19 @@ namespace Avalonia.Controls.Platform
topLevel.PlatformImpl.Paint = rect => topLevel.PlatformImpl.Paint = rect =>
{ {
viewport.Render(topLevel); try
{
viewport.Render(topLevel);
}
catch (RenderTargetCorruptedException ex)
{
Logging.Logger.Error("Renderer", this, "Render target was corrupted. Exception: {0}", ex);
viewport.Dispose();
resources.Remove(viewport);
viewport = PlatformManager.CreateRenderTarget(topLevel.PlatformImpl);
resources.Add(viewport);
topLevel.PlatformImpl.Paint(rect); // Retry painting
}
queueManager.RenderFinished(); queueManager.RenderFinished();
}; };

9
src/Avalonia.Controls/Platform/IWindowIconImpl.cs

@ -0,0 +1,9 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
namespace Avalonia.Platform
{
public interface IWindowIconImpl
{
}
}

5
src/Avalonia.Controls/Platform/IWindowImpl.cs

@ -39,5 +39,10 @@ namespace Avalonia.Platform
/// Enables of disables system window decorations (title bar, buttons, etc) /// Enables of disables system window decorations (title bar, buttons, etc)
/// </summary> /// </summary>
void SetSystemDecorations(bool enabled); void SetSystemDecorations(bool enabled);
/// <summary>
/// Sets the icon of this window.
/// </summary>
void SetIcon(IWindowIconImpl icon);
} }
} }

8
src/Avalonia.Controls/Presenters/ItemVirtualizer.cs

@ -185,8 +185,12 @@ namespace Avalonia.Controls.Presenters
/// <inheritdoc/> /// <inheritdoc/>
public virtual void Dispose() public virtual void Dispose()
{ {
VirtualizingPanel.Controller = null; if (VirtualizingPanel != null)
VirtualizingPanel.Children.Clear(); {
VirtualizingPanel.Controller = null;
VirtualizingPanel.Children.Clear();
}
Owner.ItemContainerGenerator.Clear(); Owner.ItemContainerGenerator.Clear();
} }

4
src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs

@ -116,7 +116,7 @@ namespace Avalonia.Controls.Presenters
CreateAndRemoveContainers(); CreateAndRemoveContainers();
if (e.NewStartingIndex >= FirstIndex && if (e.NewStartingIndex >= FirstIndex &&
e.NewStartingIndex + e.NewItems.Count <= NextIndex) e.NewStartingIndex < NextIndex)
{ {
RecycleContainers(); RecycleContainers();
} }
@ -125,7 +125,7 @@ namespace Avalonia.Controls.Presenters
case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Remove:
if (e.OldStartingIndex >= FirstIndex && if (e.OldStartingIndex >= FirstIndex &&
e.OldStartingIndex + e.OldItems.Count <= NextIndex) e.OldStartingIndex < NextIndex)
{ {
RecycleContainersOnRemove(); RecycleContainersOnRemove();
} }

2
src/Avalonia.Controls/Presenters/ItemsPresenter.cs

@ -20,7 +20,7 @@ namespace Avalonia.Controls.Presenters
public static readonly StyledProperty<ItemVirtualizationMode> VirtualizationModeProperty = public static readonly StyledProperty<ItemVirtualizationMode> VirtualizationModeProperty =
AvaloniaProperty.Register<ItemsPresenter, ItemVirtualizationMode>( AvaloniaProperty.Register<ItemsPresenter, ItemVirtualizationMode>(
nameof(VirtualizationMode), nameof(VirtualizationMode),
defaultValue: ItemVirtualizationMode.Simple); defaultValue: ItemVirtualizationMode.None);
private ItemVirtualizer _virtualizer; private ItemVirtualizer _virtualizer;

8
src/Avalonia.Controls/Primitives/AdornerLayer.cs

@ -57,11 +57,11 @@ namespace Avalonia.Controls.Primitives
{ {
var info = (AdornedElementInfo)child.GetValue(s_adornedElementInfoProperty); var info = (AdornedElementInfo)child.GetValue(s_adornedElementInfoProperty);
if (info != null) if (info != null && info.Bounds.HasValue)
{ {
child.RenderTransform = new MatrixTransform(info.Bounds.Transform); child.RenderTransform = new MatrixTransform(info.Bounds.Value.Transform);
child.RenderTransformOrigin = new RelativePoint(new Point(0,0), RelativeUnit.Absolute); child.RenderTransformOrigin = new RelativePoint(new Point(0,0), RelativeUnit.Absolute);
child.Arrange(info.Bounds.Bounds); child.Arrange(info.Bounds.Value.Bounds);
} }
else else
{ {
@ -130,7 +130,7 @@ namespace Avalonia.Controls.Primitives
{ {
public IDisposable Subscription { get; set; } public IDisposable Subscription { get; set; }
public TransformedBounds Bounds { get; set; } public TransformedBounds? Bounds { get; set; }
} }
} }
} }

105
src/Avalonia.Controls/TextBox.cs

@ -316,7 +316,7 @@ namespace Avalonia.Controls
break; break;
case Key.X: case Key.X:
if(modifiers == InputModifiers.Control) if (modifiers == InputModifiers.Control)
{ {
Copy(); Copy();
DeleteSelection(); DeleteSelection();
@ -372,6 +372,11 @@ namespace Avalonia.Controls
break; break;
case Key.Back: case Key.Back:
if (modifiers == InputModifiers.Control && SelectionStart == SelectionEnd)
{
SetSelectionForControlBackspace(modifiers);
}
if (!DeleteSelection() && CaretIndex > 0) if (!DeleteSelection() && CaretIndex > 0)
{ {
SetTextInternal(text.Substring(0, caretIndex - 1) + text.Substring(caretIndex)); SetTextInternal(text.Substring(0, caretIndex - 1) + text.Substring(caretIndex));
@ -381,6 +386,11 @@ namespace Avalonia.Controls
break; break;
case Key.Delete: case Key.Delete:
if (modifiers == InputModifiers.Control && SelectionStart == SelectionEnd)
{
SetSelectionForControlDelete(modifiers);
}
if (!DeleteSelection() && caretIndex < text.Length) if (!DeleteSelection() && caretIndex < text.Length)
{ {
SetTextInternal(text.Substring(0, caretIndex) + text.Substring(caretIndex + 1)); SetTextInternal(text.Substring(0, caretIndex) + text.Substring(caretIndex + 1));
@ -514,27 +524,84 @@ namespace Avalonia.Controls
{ {
var text = Text; var text = Text;
var length = text?.Length ?? 0; var length = text?.Length ?? 0;
return Math.Max(0, Math.Min(length, value));
if (value < 0)
{
return 0;
}
else if (value > length)
{
return length;
}
else if (value > 0 && text[value - 1] == '\r' && text[value] == '\n')
{
return value + 1;
}
else
{
return value;
}
}
private int DeleteCharacter(int index)
{
var start = index + 1;
var text = Text;
var c = text[index];
var result = 1;
if (c == '\n' && index > 0 && text[index - 1] == '\r')
{
--index;
++result;
}
else if (c == '\r' && index < text.Length - 1 && text[index + 1] == '\n')
{
++start;
++result;
}
Text = text.Substring(0, index) + text.Substring(start);
return result;
} }
private void MoveHorizontal(int count, InputModifiers modifiers) private void MoveHorizontal(int direction, InputModifiers modifiers)
{ {
var text = Text ?? string.Empty; var text = Text ?? string.Empty;
var caretIndex = CaretIndex; var caretIndex = CaretIndex;
if ((modifiers & InputModifiers.Control) != 0) if ((modifiers & InputModifiers.Control) == 0)
{ {
if (count > 0) var index = caretIndex + direction;
if (index < 0 || index >= text.Length)
{ {
count = StringUtils.NextWord(text, caretIndex, false) - caretIndex; return;
}
var c = text[index];
if (direction > 0)
{
CaretIndex += (c == '\r' && index < text.Length - 1 && text[index + 1] == '\n') ? 2 : 1;
} }
else else
{ {
count = StringUtils.PreviousWord(text, caretIndex, false) - caretIndex; CaretIndex -= (c == '\n' && index > 0 && text[index - 1] == '\r') ? 2 : 1;
}
}
else
{
if (direction > 0)
{
CaretIndex += StringUtils.NextWord(text, caretIndex, false) - caretIndex;
}
else
{
CaretIndex += StringUtils.PreviousWord(text, caretIndex, false) - caretIndex;
} }
} }
CaretIndex = caretIndex += count;
} }
private void MoveVertical(int count, InputModifiers modifiers) private void MoveVertical(int count, InputModifiers modifiers)
@ -698,6 +765,26 @@ namespace Avalonia.Controls
} }
} }
private void SetSelectionForControlBackspace(InputModifiers modifiers)
{
SelectionStart = CaretIndex;
MoveHorizontal(-1, modifiers);
SelectionEnd = CaretIndex;
}
private void SetSelectionForControlDelete(InputModifiers modifiers)
{
SelectionStart = CaretIndex;
MoveHorizontal(1, modifiers);
SelectionEnd = CaretIndex;
string selection = GetSelection();
if (selection != " " && selection.EndsWith(" "))
{
SelectionEnd = CaretIndex - 1;
}
}
UndoRedoState UndoRedoHelper<UndoRedoState>.IUndoRedoHost.UndoRedoState UndoRedoState UndoRedoHelper<UndoRedoState>.IUndoRedoHost.UndoRedoState
{ {
get { return new UndoRedoState(Text, CaretIndex); } get { return new UndoRedoState(Text, CaretIndex); }

2
src/Avalonia.Controls/Utils/IEnumerableUtils.cs

@ -76,7 +76,7 @@ namespace Avalonia.Controls.Utils
} }
else else
{ {
return items.Cast<object>().ElementAt(index); return Enumerable.ElementAt(items.Cast<object>(), index);
} }
} }
} }

6
src/Avalonia.Controls/Utils/StringUtils.cs

@ -190,6 +190,12 @@ namespace Avalonia.Controls.Utils
{ {
i = cursor; i = cursor;
// skip any whitespace before the word
while (i < cr && char.IsWhiteSpace(text[i]))
{
i++;
}
// skip to the end of the current word // skip to the end of the current word
while (i < cr && !char.IsWhiteSpace(text[i])) while (i < cr && !char.IsWhiteSpace(text[i]))
{ {

4
src/Avalonia.Controls/Utils/UndoRedoHelper.cs

@ -37,7 +37,7 @@ namespace Avalonia.Controls.Utils
public void Undo() public void Undo()
{ {
if (_currentNode != null) if (_currentNode?.Previous != null)
{ {
_currentNode = _currentNode.Previous; _currentNode = _currentNode.Previous;
} }
@ -68,7 +68,7 @@ namespace Avalonia.Controls.Utils
public void Redo() public void Redo()
{ {
if (_currentNode != null) { if (_currentNode?.Next != null) {
_currentNode = _currentNode.Next; _currentNode = _currentNode.Next;
} }

1
src/Avalonia.Controls/VirtualizingStackPanel.cs

@ -74,7 +74,6 @@ namespace Avalonia.Controls
protected override Size ArrangeOverride(Size finalSize) protected override Size ArrangeOverride(Size finalSize)
{ {
_availableSpace = finalSize;
_canBeRemoved = 0; _canBeRemoved = 0;
_takenSpace = 0; _takenSpace = 0;
_averageItemSize = 0; _averageItemSize = 0;

16
src/Avalonia.Controls/Window.cs

@ -70,6 +70,12 @@ namespace Avalonia.Controls
public static readonly StyledProperty<string> TitleProperty = public static readonly StyledProperty<string> TitleProperty =
AvaloniaProperty.Register<Window, string>(nameof(Title), "Window"); AvaloniaProperty.Register<Window, string>(nameof(Title), "Window");
/// <summary>
/// Defines the <see cref="Icon"/> property.
/// </summary>
public static readonly StyledProperty<WindowIcon> IconProperty =
AvaloniaProperty.Register<Window, WindowIcon>(nameof(Icon));
private readonly NameScope _nameScope = new NameScope(); private readonly NameScope _nameScope = new NameScope();
private object _dialogResult; private object _dialogResult;
private readonly Size _maxPlatformClientSize; private readonly Size _maxPlatformClientSize;
@ -83,6 +89,7 @@ namespace Avalonia.Controls
TitleProperty.Changed.AddClassHandler<Window>((s, e) => s.PlatformImpl.SetTitle((string)e.NewValue)); TitleProperty.Changed.AddClassHandler<Window>((s, e) => s.PlatformImpl.SetTitle((string)e.NewValue));
HasSystemDecorationsProperty.Changed.AddClassHandler<Window>( HasSystemDecorationsProperty.Changed.AddClassHandler<Window>(
(s, e) => s.PlatformImpl.SetSystemDecorations((bool) e.NewValue)); (s, e) => s.PlatformImpl.SetSystemDecorations((bool) e.NewValue));
IconProperty.Changed.AddClassHandler<Window>((s, e) => s.PlatformImpl.SetIcon(((WindowIcon)e.NewValue).PlatformImpl));
} }
/// <summary> /// <summary>
@ -159,6 +166,15 @@ namespace Avalonia.Controls
set { this.PlatformImpl.WindowState = value; } set { this.PlatformImpl.WindowState = value; }
} }
/// <summary>
/// Gets or sets the icon of the window.
/// </summary>
public WindowIcon Icon
{
get { return GetValue(IconProperty); }
set { SetValue(IconProperty, value); }
}
/// <inheritdoc/> /// <inheritdoc/>
Size ILayoutRoot.MaxClientSize => _maxPlatformClientSize; Size ILayoutRoot.MaxClientSize => _maxPlatformClientSize;

34
src/Avalonia.Controls/WindowIcon.cs

@ -0,0 +1,34 @@
using Avalonia.Platform;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Media.Imaging;
namespace Avalonia.Controls
{
/// <summary>
/// Represents an icon for a window.
/// </summary>
public class WindowIcon
{
public WindowIcon(IBitmap bitmap)
{
PlatformImpl = AvaloniaLocator.Current.GetService<IPlatformIconLoader>().LoadIcon(bitmap.PlatformImpl);
}
public WindowIcon(string fileName)
{
PlatformImpl = AvaloniaLocator.Current.GetService<IPlatformIconLoader>().LoadIcon(fileName);
}
public WindowIcon(Stream stream)
{
PlatformImpl = AvaloniaLocator.Current.GetService<IPlatformIconLoader>().LoadIcon(stream);
}
public IWindowIconImpl PlatformImpl { get; }
}
}

19
src/Avalonia.Controls/app.config

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.30214.0" newVersion="2.1.30214.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

1
src/Avalonia.DesignerSupport/Avalonia.DesignerSupport.csproj

@ -95,7 +95,6 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

15
src/Avalonia.DesignerSupport/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

1
src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj

@ -137,7 +137,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<EmbeddedResource Include="DevTools.xaml"> <EmbeddedResource Include="DevTools.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>

15
src/Avalonia.Diagnostics/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

1
src/Avalonia.Input/Avalonia.Input.csproj

@ -117,7 +117,6 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

19
src/Avalonia.Input/app.config

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.30214.0" newVersion="2.1.30214.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

1
src/Avalonia.Interactivity/Avalonia.Interactivity.csproj

@ -71,7 +71,6 @@
<Compile Include="EventSubscription.cs" /> <Compile Include="EventSubscription.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

15
src/Avalonia.Interactivity/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

1
src/Avalonia.Layout/Avalonia.Layout.csproj

@ -67,7 +67,6 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

15
src/Avalonia.Layout/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

2
src/Avalonia.SceneGraph/Avalonia.SceneGraph.csproj

@ -100,6 +100,7 @@
<Compile Include="Media\FormattedText.cs" /> <Compile Include="Media\FormattedText.cs" />
<Compile Include="Media\Geometry.cs" /> <Compile Include="Media\Geometry.cs" />
<Compile Include="Media\IDrawingContext.cs" /> <Compile Include="Media\IDrawingContext.cs" />
<Compile Include="RenderTargetCorruptedException.cs" />
<Compile Include="VisualTree\IVisual.cs" /> <Compile Include="VisualTree\IVisual.cs" />
<Compile Include="Media\Imaging\Bitmap.cs" /> <Compile Include="Media\Imaging\Bitmap.cs" />
<Compile Include="Media\Imaging\IBitmap.cs" /> <Compile Include="Media\Imaging\IBitmap.cs" />
@ -152,7 +153,6 @@
<Compile Include="VisualTree\VisualExtensions.cs" /> <Compile Include="VisualTree\VisualExtensions.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

6
src/Avalonia.SceneGraph/Media/Imaging/Bitmap.cs

@ -1,6 +1,7 @@
// Copyright (c) The Avalonia Project. All rights reserved. // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.IO; using System.IO;
using Avalonia.Platform; using Avalonia.Platform;
@ -66,5 +67,10 @@ namespace Avalonia.Media.Imaging
{ {
PlatformImpl.Save(fileName); PlatformImpl.Save(fileName);
} }
public void Save(Stream stream)
{
PlatformImpl.Save(stream);
}
} }
} }

7
src/Avalonia.SceneGraph/Media/Imaging/IBitmap.cs

@ -1,6 +1,7 @@
// Copyright (c) The Avalonia Project. All rights reserved. // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.IO;
using Avalonia.Platform; using Avalonia.Platform;
namespace Avalonia.Media.Imaging namespace Avalonia.Media.Imaging
@ -30,5 +31,11 @@ namespace Avalonia.Media.Imaging
/// </summary> /// </summary>
/// <param name="fileName">The filename.</param> /// <param name="fileName">The filename.</param>
void Save(string fileName); void Save(string fileName);
/// <summary>
/// Saves the bitmap to a stream in png format.
/// </summary>
/// <param name="stream">The stream.</param>
void Save(Stream stream);
} }
} }

8
src/Avalonia.SceneGraph/Platform/IBitmapImpl.cs

@ -1,6 +1,8 @@
// Copyright (c) The Avalonia Project. All rights reserved. // Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.IO;
namespace Avalonia.Platform namespace Avalonia.Platform
{ {
/// <summary> /// <summary>
@ -23,5 +25,11 @@ namespace Avalonia.Platform
/// </summary> /// </summary>
/// <param name="fileName">The filename.</param> /// <param name="fileName">The filename.</param>
void Save(string fileName); void Save(string fileName);
/// <summary>
/// Saves the bitmap to a stream in png format.
/// </summary>
/// <param name="stream">The stream.</param>
void Save(Stream stream);
} }
} }

30
src/Avalonia.SceneGraph/RenderTargetCorruptedException.cs

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia
{
public class RenderTargetCorruptedException : Exception
{
public RenderTargetCorruptedException()
{
}
public RenderTargetCorruptedException(string message)
: base(message)
{
}
public RenderTargetCorruptedException(Exception innerException)
: base(null, innerException)
{
}
public RenderTargetCorruptedException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}

17
src/Avalonia.SceneGraph/Rendering/RendererMixin.cs

@ -142,11 +142,28 @@ namespace Avalonia.Rendering
var childClipRect = clipRect.Translate(-childBounds.Position); var childClipRect = clipRect.Translate(-childBounds.Position);
context.Render(child, childClipRect); context.Render(child, childClipRect);
} }
else
{
ClearTransformedBounds(child);
}
} }
ReturnListToPool(lst); ReturnListToPool(lst);
} }
} }
if (!visual.IsVisible)
{
ClearTransformedBounds(visual);
}
}
private static void ClearTransformedBounds(IVisual visual)
{
foreach (var e in visual.GetSelfAndVisualDescendents())
{
BoundsTracker.SetTransformedBounds((Visual)visual, null);
}
} }
private static void ReturnListToPool(List<IVisual> lst) private static void ReturnListToPool(List<IVisual> lst)

26
src/Avalonia.SceneGraph/VisualTree/BoundsTracker.cs

@ -9,33 +9,43 @@ namespace Avalonia.VisualTree
/// Tracks the bounds of a control. /// Tracks the bounds of a control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This class is used by Adorners to track the control that the adorner is attached to. /// This class is used to track a controls's bounds for hit testing.
/// TODO: This shouldn't be implemented as an attached property: it would be more performant
/// to just store bounds in some sort of central repository.
/// </remarks> /// </remarks>
public class BoundsTracker public class BoundsTracker
{ {
private static AttachedProperty<TransformedBounds> TransformedBoundsProperty = /// <summary>
AvaloniaProperty.RegisterAttached<BoundsTracker, Visual, TransformedBounds>("TransformedBounds"); /// Defines the TransformedBounds attached property.
/// </summary>
private static AttachedProperty<TransformedBounds?> TransformedBoundsProperty =
AvaloniaProperty.RegisterAttached<BoundsTracker, Visual, TransformedBounds?>("TransformedBounds");
/// <summary> /// <summary>
/// Starts tracking the specified visual. /// Starts tracking the specified visual.
/// </summary> /// </summary>
/// <param name="visual">The visual.</param> /// <param name="visual">The visual.</param>
/// <returns>An observable that returns the tracked bounds.</returns> /// <returns>An observable that returns the tracked bounds.</returns>
public IObservable<TransformedBounds> Track(Visual visual) public IObservable<TransformedBounds?> Track(Visual visual)
{ {
return visual.GetObservable(TransformedBoundsProperty); return visual.GetObservable(TransformedBoundsProperty);
} }
internal static void SetTransformedBounds(Visual visual, TransformedBounds bounds) /// <summary>
/// Sets the transformed bounds of the visual.
/// </summary>
/// <param name="visual">The visual.</param>
/// <param name="value">The transformed bounds.</param>
internal static void SetTransformedBounds(Visual visual, TransformedBounds? value)
{ {
visual.SetValue(TransformedBoundsProperty, bounds); visual.SetValue(TransformedBoundsProperty, value);
} }
/// <summary> /// <summary>
/// Gets the transformed bounds of the visual. /// Gets the transformed bounds of the visual.
/// </summary> /// </summary>
/// <param name="visual">The visual.</param> /// <param name="visual">The visual.</param>
/// <returns>The transformed bounds.</returns> /// <returns>The transformed bounds or null if the visual is not visible.</returns>
public static TransformedBounds GetTransformedBounds(Visual visual) => visual.GetValue(TransformedBoundsProperty); public static TransformedBounds? GetTransformedBounds(Visual visual) => visual.GetValue(TransformedBoundsProperty);
} }
} }

2
src/Avalonia.SceneGraph/VisualTree/VisualExtensions.cs

@ -104,7 +104,7 @@ namespace Avalonia.VisualTree
if (filter?.Invoke(visual) != false) if (filter?.Invoke(visual) != false)
{ {
bool containsPoint = BoundsTracker.GetTransformedBounds((Visual)visual).Contains(p); bool containsPoint = BoundsTracker.GetTransformedBounds((Visual)visual)?.Contains(p) == true;
if ((containsPoint || !visual.ClipToBounds) && visual.VisualChildren.Any()) if ((containsPoint || !visual.ClipToBounds) && visual.VisualChildren.Any())
{ {

15
src/Avalonia.SceneGraph/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

1
src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj

@ -89,7 +89,6 @@
<EmbeddedResource Include="Accents\BaseLight.xaml"> <EmbeddedResource Include="Accents\BaseLight.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<None Include="app.config" />
<EmbeddedResource Include="Button.xaml"> <EmbeddedResource Include="Button.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>

17
src/Avalonia.Themes.Default/DropDown.xaml

@ -12,7 +12,7 @@
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
<ContentPresenter Content="{TemplateBinding SelectionBoxItem}" <ContentPresenter Content="{TemplateBinding SelectionBoxItem}"
Margin="{TemplateBinding Padding}" Margin="{TemplateBinding Padding}"
HorizontalAlignment="Center" HorizontalAlignment="Left"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
<ToggleButton Name="toggle" <ToggleButton Name="toggle"
BorderThickness="0" BorderThickness="0"
@ -30,16 +30,19 @@
Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z"/> Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z"/>
</ToggleButton> </ToggleButton>
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
IsOpen="{TemplateBinding Path=IsDropDownOpen, Mode=TwoWay}" IsOpen="{TemplateBinding IsDropDownOpen, Mode=TwoWay}"
MinWidth="{TemplateBinding Path=Bounds.Width}" MinWidth="{TemplateBinding Bounds.Width}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
PlacementTarget="{TemplateBinding}" PlacementTarget="{TemplateBinding}"
StaysOpen="False"> StaysOpen="False">
<Border BorderBrush="{StyleResource ThemeBorderMidBrush}" <Border BorderBrush="{StyleResource ThemeBorderMidBrush}"
BorderThickness="1"> BorderThickness="1">
<ItemsPresenter Name="PART_ItemsPresenter" <ScrollViewer>
Items="{TemplateBinding Items}" <ItemsPresenter Name="PART_ItemsPresenter"
ItemTemplate="{TemplateBinding ItemTemplate}" Items="{TemplateBinding Items}"
MemberSelector="{TemplateBinding MemberSelector}"/> ItemTemplate="{TemplateBinding ItemTemplate}"
MemberSelector="{TemplateBinding MemberSelector}"/>
</ScrollViewer>
</Border> </Border>
</Popup> </Popup>
</Grid> </Grid>

6
src/Avalonia.Themes.Default/Expander.xaml

@ -90,7 +90,11 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Data="M 0 2 L 4 6 L 0 10 Z" /> Data="M 0 2 L 4 6 L 0 10 Z" />
</Border> </Border>
<ContentPresenter Grid.Column="1" Content="{TemplateBinding Content}" VerticalAlignment="Center" /> <ContentPresenter Name="PART_ContentPresenter"
Grid.Column="1"
Background="Transparent"
Content="{TemplateBinding Content}"
VerticalAlignment="Center" />
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>

15
src/Avalonia.Themes.Default/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

38
src/Gtk/Avalonia.Cairo/Media/DrawingContext.cs

@ -85,25 +85,25 @@ namespace Avalonia.Cairo.Media
_context.Scale(scale.X, scale.Y); _context.Scale(scale.X, scale.Y);
destRect /= scale; destRect /= scale;
if (opacityOverride < 1.0f) { if (opacityOverride < 1.0f) {
_context.PushGroup (); _context.PushGroup ();
Gdk.CairoHelper.SetSourcePixbuf ( Gdk.CairoHelper.SetSourcePixbuf (
_context, _context,
impl.Surface, impl,
-sourceRect.X + destRect.X, -sourceRect.X + destRect.X,
-sourceRect.Y + destRect.Y); -sourceRect.Y + destRect.Y);
_context.Rectangle (destRect.ToCairo ()); _context.Rectangle (destRect.ToCairo ());
_context.Fill (); _context.Fill ();
_context.PopGroupToSource (); _context.PopGroupToSource ();
_context.PaintWithAlpha (opacityOverride); _context.PaintWithAlpha (opacityOverride);
} else { } else {
_context.PushGroup (); _context.PushGroup ();
Gdk.CairoHelper.SetSourcePixbuf ( Gdk.CairoHelper.SetSourcePixbuf (
_context, _context,
impl.Surface, impl,
-sourceRect.X + destRect.X, -sourceRect.X + destRect.X,
-sourceRect.Y + destRect.Y); -sourceRect.Y + destRect.Y);
_context.Rectangle (destRect.ToCairo ()); _context.Rectangle (destRect.ToCairo ());
_context.Fill (); _context.Fill ();

20
src/Gtk/Avalonia.Cairo/Media/Imaging/BitmapImpl.cs

@ -6,28 +6,30 @@ using Avalonia.Platform;
namespace Avalonia.Cairo.Media.Imaging namespace Avalonia.Cairo.Media.Imaging
{ {
using System.IO;
using Cairo = global::Cairo; using Cairo = global::Cairo;
public class BitmapImpl : IBitmapImpl public class BitmapImpl : Gdk.Pixbuf, IBitmapImpl
{ {
public BitmapImpl(Gdk.Pixbuf pixbuf) public BitmapImpl(Gdk.Pixbuf pixbuf)
:base(pixbuf.SaveToBuffer("png"))
{ {
Surface = pixbuf;
} }
public int PixelWidth => Surface.Width; public int PixelWidth => Width;
public int PixelHeight => Surface.Height; public int PixelHeight => Height;
public Gdk.Pixbuf Surface public void Save(string fileName)
{ {
get; // TODO: Test
Save(fileName, "png");
} }
public void Save(string fileName) public void Save(Stream stream)
{ {
// TODO: Test var buffer = SaveToBuffer("png");
Surface.Save(fileName, "png"); stream.Write(buffer, 0, buffer.Length);
} }
} }
} }

11
src/Gtk/Avalonia.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs

@ -8,6 +8,7 @@ using Avalonia.Rendering;
namespace Avalonia.Cairo.Media.Imaging namespace Avalonia.Cairo.Media.Imaging
{ {
using System.IO;
using Cairo = global::Cairo; using Cairo = global::Cairo;
public class RenderTargetBitmapImpl : IRenderTargetBitmapImpl public class RenderTargetBitmapImpl : IRenderTargetBitmapImpl
@ -43,5 +44,15 @@ namespace Avalonia.Cairo.Media.Imaging
{ {
return _renderTarget.CreateDrawingContext(); return _renderTarget.CreateDrawingContext();
} }
public void Save(Stream stream)
{
var tempFileName = Path.GetTempFileName();
Surface.WriteToPng(tempFileName);
using (var tempFile = new FileStream(tempFileName, FileMode.Create))
{
tempFile.CopyTo(stream);
}
}
} }
} }

11
src/Gtk/Avalonia.Cairo/Media/StreamGeometryContextImpl.cs

@ -91,9 +91,6 @@ namespace Avalonia.Cairo.Media
{ {
if (isClosed) if (isClosed)
_context.ClosePath (); _context.ClosePath ();
Path = _context.CopyPath ();
Bounds = _context.FillExtents ().ToAvalonia ();
} }
} }
@ -105,7 +102,13 @@ namespace Avalonia.Cairo.Media
public void Dispose() public void Dispose()
{ {
_context.Dispose (); if (this.Path == null)
{
Path = _context.CopyPath();
Bounds = _context.FillExtents().ToAvalonia();
}
_context.Dispose ();
_surf.Dispose (); _surf.Dispose ();
} }
} }

1
src/Gtk/Avalonia.Gtk/Avalonia.Gtk.csproj

@ -46,6 +46,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ClipboardImpl.cs" /> <Compile Include="ClipboardImpl.cs" />
<Compile Include="IconImpl.cs" />
<Compile Include="SystemDialogImpl.cs" /> <Compile Include="SystemDialogImpl.cs" />
<Compile Include="CursorFactory.cs" /> <Compile Include="CursorFactory.cs" />
<Compile Include="GtkExtensions.cs" /> <Compile Include="GtkExtensions.cs" />

32
src/Gtk/Avalonia.Gtk/GtkPlatform.cs

@ -25,9 +25,10 @@ namespace Avalonia
namespace Avalonia.Gtk namespace Avalonia.Gtk
{ {
using System.IO;
using Gtk = global::Gtk; using Gtk = global::Gtk;
public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform public class GtkPlatform : IPlatformThreadingInterface, IPlatformSettings, IWindowingPlatform, IPlatformIconLoader
{ {
private static readonly GtkPlatform s_instance = new GtkPlatform(); private static readonly GtkPlatform s_instance = new GtkPlatform();
private static Thread _uiThread; private static Thread _uiThread;
@ -53,7 +54,8 @@ namespace Avalonia.Gtk
.Bind<IMouseDevice>().ToConstant(GtkMouseDevice.Instance) .Bind<IMouseDevice>().ToConstant(GtkMouseDevice.Instance)
.Bind<IPlatformSettings>().ToConstant(s_instance) .Bind<IPlatformSettings>().ToConstant(s_instance)
.Bind<IPlatformThreadingInterface>().ToConstant(s_instance) .Bind<IPlatformThreadingInterface>().ToConstant(s_instance)
.Bind<ISystemDialogImpl>().ToSingleton<SystemDialogImpl>(); .Bind<ISystemDialogImpl>().ToSingleton<SystemDialogImpl>()
.Bind<IPlatformIconLoader>().ToConstant(s_instance);
SharedPlatform.Register(); SharedPlatform.Register();
_uiThread = Thread.CurrentThread; _uiThread = Thread.CurrentThread;
} }
@ -112,5 +114,31 @@ namespace Avalonia.Gtk
{ {
return new PopupImpl(); return new PopupImpl();
} }
public IWindowIconImpl LoadIcon(string fileName)
{
return new IconImpl(new Gdk.Pixbuf(fileName));
}
public IWindowIconImpl LoadIcon(Stream stream)
{
return new IconImpl(new Gdk.Pixbuf(stream));
}
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap)
{
if (bitmap is Gdk.Pixbuf)
{
return new IconImpl((Gdk.Pixbuf)bitmap);
}
else
{
using (var memoryStream = new MemoryStream())
{
bitmap.Save(memoryStream);
return new IconImpl(new Gdk.Pixbuf(memoryStream));
}
}
}
} }
} }

20
src/Gtk/Avalonia.Gtk/IconImpl.cs

@ -0,0 +1,20 @@
using Avalonia.Platform;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Gdk;
namespace Avalonia.Gtk
{
class IconImpl : IWindowIconImpl
{
public IconImpl(Pixbuf pixbuf)
{
Pixbuf = pixbuf;
}
public Pixbuf Pixbuf { get; }
}
}

37
src/Gtk/Avalonia.Gtk/WindowImpl.cs

@ -20,8 +20,8 @@ namespace Avalonia.Gtk
public class WindowImpl : Gtk.Window, IWindowImpl, IPlatformHandle public class WindowImpl : Gtk.Window, IWindowImpl, IPlatformHandle
{ {
private IInputRoot _inputRoot; private IInputRoot _inputRoot;
private Size _clientSize; private Size _lastClientSize;
private Gtk.IMContext _imContext; private Gtk.IMContext _imContext;
@ -51,18 +51,29 @@ namespace Avalonia.Gtk
_imContext.Commit += ImContext_Commit; _imContext.Commit += ImContext_Commit;
DoubleBuffered = false; DoubleBuffered = false;
Realize(); Realize();
_lastClientSize = ClientSize;
} }
protected override void OnRealized () protected override void OnRealized ()
{ {
base.OnRealized (); base.OnRealized ();
_imContext.ClientWindow = this.GdkWindow; _imContext.ClientWindow = this.GdkWindow;
} }
public Size ClientSize public Size ClientSize
{ {
get; get
set; {
int width;
int height;
GetSize(out width, out height);
return new Size(width, height);
}
set
{
Resize((int)value.Width, (int)value.Height);
}
} }
public Size MaxClientSize public Size MaxClientSize
@ -321,9 +332,10 @@ namespace Avalonia.Gtk
{ {
var newSize = new Size(evnt.Width, evnt.Height); var newSize = new Size(evnt.Width, evnt.Height);
if (newSize != _clientSize) if (newSize != _lastClientSize)
{ {
Resized(newSize); Resized(newSize);
_lastClientSize = newSize;
} }
return true; return true;
@ -383,5 +395,10 @@ namespace Avalonia.Gtk
Input(e); Input(e);
return true; return true;
} }
public void SetIcon(IWindowIconImpl icon)
{
Icon = ((IconImpl)icon).Pixbuf;
}
} }
} }

4
src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj

@ -62,6 +62,7 @@
<Compile Include="Converters\DateTimeTypeConverter.cs" /> <Compile Include="Converters\DateTimeTypeConverter.cs" />
<Compile Include="Converters\GeometryTypeConverter.cs" /> <Compile Include="Converters\GeometryTypeConverter.cs" />
<Compile Include="Converters\GridLengthTypeConverter.cs" /> <Compile Include="Converters\GridLengthTypeConverter.cs" />
<Compile Include="Converters\IconTypeConverter.cs" />
<Compile Include="Converters\KeyGestureConverter.cs" /> <Compile Include="Converters\KeyGestureConverter.cs" />
<Compile Include="Converters\MemberSelectorTypeConverter.cs" /> <Compile Include="Converters\MemberSelectorTypeConverter.cs" />
<Compile Include="Converters\AvaloniaListTypeConverter.cs" /> <Compile Include="Converters\AvaloniaListTypeConverter.cs" />
@ -93,6 +94,8 @@
<Compile Include="glass\Glass.Core\ReflectionExtensions.cs" /> <Compile Include="glass\Glass.Core\ReflectionExtensions.cs" />
<Compile Include="glass\Glass.Core\StackingLinkedList.cs" /> <Compile Include="glass\Glass.Core\StackingLinkedList.cs" />
<Compile Include="glass\Glass.Core\StackingLinkedListMixin.cs" /> <Compile Include="glass\Glass.Core\StackingLinkedListMixin.cs" />
<Compile Include="MarkupExtensions\Standard\StaticExtension.cs" />
<Compile Include="MarkupExtensions\Standard\TypeExtension.cs" />
<Compile Include="MarkupExtensions\StyleResourceExtension.cs" /> <Compile Include="MarkupExtensions\StyleResourceExtension.cs" />
<Compile Include="MarkupExtensions\BindingExtension.cs" /> <Compile Include="MarkupExtensions\BindingExtension.cs" />
<Compile Include="MarkupExtensions\RelativeSourceExtension.cs" /> <Compile Include="MarkupExtensions\RelativeSourceExtension.cs" />
@ -276,7 +279,6 @@
<Compile Include="Templates\TreeDataTemplate.cs" /> <Compile Include="Templates\TreeDataTemplate.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="glass\Glass.Core\Glass.Core.nuspec" /> <None Include="glass\Glass.Core\Glass.Core.nuspec" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>

1
src/Markup/Avalonia.Markup.Xaml/Context/AvaloniaTypeFeatureProvider.cs

@ -173,6 +173,7 @@ namespace Avalonia.Markup.Xaml.Context
RegisterTypeConverter(typeof(TimeSpan), new TimeSpanTypeConverter()); RegisterTypeConverter(typeof(TimeSpan), new TimeSpanTypeConverter());
RegisterTypeConverter(typeof(Uri), new UriTypeConverter()); RegisterTypeConverter(typeof(Uri), new UriTypeConverter());
RegisterTypeConverter(typeof(Cursor), new CursorTypeConverter()); RegisterTypeConverter(typeof(Cursor), new CursorTypeConverter());
RegisterTypeConverter(typeof(WindowIcon), new IconTypeConverter());
} }
} }
} }

70
src/Markup/Avalonia.Markup.Xaml/Converters/IconTypeConverter.cs

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using OmniXaml.TypeConversion;
namespace Avalonia.Markup.Xaml.Converters
{
class IconTypeConverter : ITypeConverter
{
public bool CanConvertFrom(IValueContext context, Type sourceType)
{
return sourceType == typeof(string) || typeof(IBitmap).GetTypeInfo().IsAssignableFrom(sourceType.GetTypeInfo());
}
public bool CanConvertTo(IValueContext context, Type destinationType)
{
return false;
}
public object ConvertFrom(IValueContext context, CultureInfo culture, object value)
{
var path = value as string;
if (path != null)
{
return CreateIconFromPath(context, path);
}
var bitmap = value as IBitmap;
if (bitmap != null)
{
return new WindowIcon(bitmap);
}
throw new NotSupportedException();
}
private WindowIcon CreateIconFromPath(IValueContext context, string path)
{
var uri = new Uri(path, UriKind.RelativeOrAbsolute);
var baseUri = GetBaseUri(context);
var scheme = uri.IsAbsoluteUri ? uri.Scheme : "file";
switch (scheme)
{
case "file":
return new WindowIcon(path);
default:
var assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
return new WindowIcon(assets.Open(uri, baseUri));
}
}
public object ConvertTo(IValueContext context, CultureInfo culture, object value, Type destinationType)
{
throw new NotImplementedException();
}
private Uri GetBaseUri(IValueContext context)
{
object result;
context.ParsingDictionary.TryGetValue("Uri", out result);
return result as Uri;
}
}
}

86
src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/Standard/StaticExtension.cs

@ -0,0 +1,86 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using System.Linq;
using System.Reflection;
using OmniXaml;
using Glass.Core;
namespace Avalonia.Markup.Xaml.MarkupExtensions.Standard
{
public class StaticExtension : MarkupExtension
{
public StaticExtension()
{
}
public StaticExtension(string identifier)
{
Identifier = identifier;
}
public string Identifier { get; set; }
public override object ProvideValue(MarkupExtensionContext markupExtensionContext)
{
var typeRepository = markupExtensionContext.ValueContext.TypeRepository;
var typeAndMember = GetTypeAndMember(Identifier);
var prefixAndType = GetPrefixAndType(typeAndMember.Item1);
var xamlType = typeRepository.GetByPrefix(prefixAndType.Item1, prefixAndType.Item2);
return GetValue(xamlType.UnderlyingType, typeAndMember.Item2);
}
private static Tuple<string, string> GetTypeAndMember(string s)
{
var parts = s.Split('.');
if (parts.Length != 2)
{
throw new ArgumentException("Static member must be in the form Type.Member.");
}
return Tuple.Create(parts[0], parts[1]);
}
private static Tuple<string, string> GetPrefixAndType(string s)
{
if (s.Contains(":"))
{
return s.Dicotomize(':');
}
else
{
return new Tuple<string, string>(string.Empty, s);
}
}
private object GetValue(Type type, string name)
{
var t = type;
while (t != null)
{
var result = t.GetTypeInfo().DeclaredMembers.FirstOrDefault(x => x.Name == name);
if (result is PropertyInfo)
{
var property = ((PropertyInfo)result);
if (property.GetMethod.IsStatic)
{
return ((PropertyInfo)result).GetValue(null);
}
}
else if (result is FieldInfo)
{
return ((FieldInfo)result).GetValue(null);
}
t = t.GetTypeInfo().BaseType;
}
throw new ArgumentException($"Static member '{type}.{name}' not found.");
}
}
}

49
src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/Standard/TypeExtension.cs

@ -0,0 +1,49 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using OmniXaml;
using OmniXaml.Attributes;
using OmniXaml.Typing;
using Glass.Core;
namespace Avalonia.Markup.Xaml.MarkupExtensions.Standard
{
[ContentProperty("TargetType")]
public class TypeExtension : MarkupExtension
{
public Type Type { get; set; }
public TypeExtension()
{
}
public TypeExtension(Type type)
{
Type = type;
}
public string TypeName { get; set; }
private Type ResolveFromString(string type, ITypeRepository typeRepository)
{
Guard.ThrowIfNull(type, nameof(type));
var split = type.Split(':');
var prefix = split.Length == 1 ? split[0] : null;
var typeName = split.Length == 1 ? split[1] : split[0];
var xamlType = typeRepository.GetByPrefix(prefix, typeName);
return xamlType.UnderlyingType;
}
public override object ProvideValue(MarkupExtensionContext markupExtensionContext)
{
if (Type != null)
{
return Type;
}
return ResolveFromString(TypeName, markupExtensionContext.ValueContext.TypeRepository);
}
}
}

1
src/Markup/Avalonia.Markup.Xaml/Properties/AssemblyInfo.cs

@ -10,5 +10,6 @@ using System.Runtime.CompilerServices;
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Markup.Xaml.MarkupExtensions")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Markup.Xaml.MarkupExtensions")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Markup.Xaml.Styling")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Markup.Xaml.Styling")]
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Markup.Xaml.Templates")] [assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia.Markup.Xaml.Templates")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "Avalonia.Markup.Xaml.MarkupExtensions.Standard")]
[assembly: InternalsVisibleTo("Avalonia.Markup.Xaml.UnitTests")] [assembly: InternalsVisibleTo("Avalonia.Markup.Xaml.UnitTests")]

11
src/Markup/Avalonia.Markup.Xaml/app.config

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Interfaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

8
src/Shared/SharedAssemblyInfo.cs

@ -6,13 +6,13 @@ using System.Resources;
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright \u00A9 2015")] [assembly: AssemblyCopyright("Copyright AvaloniaUI 2016")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyProduct("Avalonia")] [assembly: AssemblyProduct("Avalonia")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en")] [assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.0.0.1")] [assembly: AssemblyVersion("0.4.0")]
[assembly: AssemblyFileVersion("0.0.0.1")] [assembly: AssemblyFileVersion("0.4.0")]
[assembly: AssemblyInformationalVersion("0.0.1-alpha")] [assembly: AssemblyInformationalVersion("0.4.0")]

4
src/Skia/Avalonia.Skia.Android/Avalonia.Skia.Android.csproj

@ -39,8 +39,8 @@
<ItemGroup> <ItemGroup>
<Reference Include="Mono.Android" /> <Reference Include="Mono.Android" />
<Reference Include="mscorlib" /> <Reference Include="mscorlib" />
<Reference Include="SkiaSharp, Version=1.49.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SkiaSharp, Version=1.53.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\SkiaSharp.1.49.4-beta\lib\MonoAndroid\SkiaSharp.dll</HintPath> <HintPath>..\..\..\packages\SkiaSharp.1.53.0\lib\MonoAndroid\SkiaSharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />

2
src/Skia/Avalonia.Skia.Android/packages.config

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="SkiaSharp" version="1.49.4-beta" targetFramework="monoandroid44" /> <package id="SkiaSharp" version="1.53.0" targetFramework="monoandroid44" />
</packages> </packages>

8
src/Skia/Avalonia.Skia.Desktop/Avalonia.Skia.Desktop.csproj

@ -56,8 +56,8 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="SkiaSharp, Version=1.49.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SkiaSharp, Version=1.53.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\SkiaSharp.1.49.4-beta\lib\net45\SkiaSharp.dll</HintPath> <HintPath>..\..\..\packages\SkiaSharp.1.53.0\lib\net45\SkiaSharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
@ -116,12 +116,12 @@
<Import Project="..\Avalonia.Skia\Avalonia.Skia.projitems" Label="Shared" /> <Import Project="..\Avalonia.Skia\Avalonia.Skia.projitems" Label="Shared" />
<Import Project="..\..\Shared\RenderHelpers\RenderHelpers.projitems" Label="Shared" /> <Import Project="..\..\Shared\RenderHelpers\RenderHelpers.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\SkiaSharp.1.49.4-beta\build\net45\SkiaSharp.targets" Condition="Exists('..\..\..\packages\SkiaSharp.1.49.4-beta\build\net45\SkiaSharp.targets')" /> <Import Project="..\..\..\packages\SkiaSharp.1.53.0\build\net45\SkiaSharp.targets" Condition="Exists('..\..\..\packages\SkiaSharp.1.53.0\build\net45\SkiaSharp.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\SkiaSharp.1.49.4-beta\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\SkiaSharp.1.49.4-beta\build\net45\SkiaSharp.targets'))" /> <Error Condition="!Exists('..\..\..\packages\SkiaSharp.1.53.0\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\SkiaSharp.1.53.0\build\net45\SkiaSharp.targets'))" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

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

Loading…
Cancel
Save