159 changed files with 2926 additions and 2730 deletions
@ -0,0 +1,17 @@ |
|||||
|
This template is not intended to be prescriptive, but to help us review pull requests it would be useful if you included as much of the following information as possible: |
||||
|
|
||||
|
- What does the pull request do? |
||||
|
- What is the current behavior? |
||||
|
- What is the updated/expected behavior with this PR? |
||||
|
- How was the solution implemented (if it's not obvious)? |
||||
|
|
||||
|
Checklist: |
||||
|
|
||||
|
- [ ] Added unit tests (if possible)? |
||||
|
- [ ] Added XML documentation to any related classes? |
||||
|
- [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Avaloniaui.net with user documentation |
||||
|
|
||||
|
If the pull request fixes issue(s) list them like this: |
||||
|
|
||||
|
Fixes #123 |
||||
|
Fixes #456 |
||||
@ -0,0 +1,11 @@ |
|||||
|
<Project DefaultTargets="Build" |
||||
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<ItemGroup> |
||||
|
<Compile Update="**\*.xaml.cs"> |
||||
|
<DependentUpon>%(Filename)</DependentUpon> |
||||
|
</Compile> |
||||
|
<EmbeddedResource Include="**\*.xaml"> |
||||
|
<SubType>Designer</SubType> |
||||
|
</EmbeddedResource> |
||||
|
</ItemGroup> |
||||
|
</Project> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<PropertyGroup Condition="'$(TargetFramework)'=='net461'" > |
||||
|
<OutputType>WinExe</OutputType> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<!-- Should be a Condition="'$(TargetFramework)'=='net461'" here but that doesn't work due |
||||
|
to https://github.com/dotnet/sdk/issues/1227 --> |
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" /> |
||||
|
</ItemGroup> |
||||
|
<Import Condition="'$(TargetFramework)'=='net461'" Project="SharpDX.props" /> |
||||
|
</Project> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<Project DefaultTargets="Build" |
||||
|
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
|
<PropertyGroup> |
||||
|
<Product>Avalonia</Product> |
||||
|
<Version>0.6.2</Version> |
||||
|
<Copyright>Copyright 2016 © The AvaloniaUI Project</Copyright> |
||||
|
<PackageLicenseUrl>https://github.com/AvaloniaUI/Avalonia/blob/master/licence.md</PackageLicenseUrl> |
||||
|
<PackageProjectUrl>https://github.com/AvaloniaUI/Avalonia/</PackageProjectUrl> |
||||
|
<RepositoryUrl>https://github.com/AvaloniaUI/Avalonia/</RepositoryUrl> |
||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile> |
||||
|
<NoWarn>CS1591</NoWarn> |
||||
|
</PropertyGroup> |
||||
|
</Project> |
||||
@ -1,155 +1,33 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<Project ToolsVersion="15.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')" /> |
|
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<OutputType>Exe</OutputType> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
||||
<ProjectGuid>{08B3E6B9-1CD5-443C-9F61-6D49D1C5F162}</ProjectGuid> |
|
||||
<OutputType>WinExe</OutputType> |
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
||||
<RootNamespace>BindingTest</RootNamespace> |
|
||||
<AssemblyName>BindingTest</AssemblyName> |
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|
||||
<FileAlignment>512</FileAlignment> |
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
||||
<TargetFrameworkProfile /> |
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup> |
|
||||
<StartupObject /> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<Reference Include="System" /> |
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" /> |
|
||||
<Reference Include="System.Core" /> |
|
||||
<Reference Include="System.Xml.Linq" /> |
|
||||
<Reference Include="System.Data.DataSetExtensions" /> |
|
||||
<Reference Include="Microsoft.CSharp" /> |
|
||||
<Reference Include="System.Data" /> |
|
||||
<Reference Include="System.Xml" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="App.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
<Compile Include="App.xaml.cs"> |
|
||||
<DependentUpon>App.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="MainWindow.xaml.cs"> |
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
||||
<Compile Include="TestItemView.xaml.cs"> |
|
||||
<DependentUpon>TestItemView.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="ViewModels\DataAnnotationsErrorViewModel.cs" /> |
|
||||
<Compile Include="ViewModels\IndeiErrorViewModel.cs" /> |
|
||||
<Compile Include="ViewModels\ExceptionErrorViewModel.cs" /> |
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" /> |
|
||||
<Compile Include="ViewModels\NestedCommandViewModel.cs" /> |
|
||||
<Compile Include="ViewModels\TestItem.cs" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<None Include="App.config" /> |
|
||||
<EmbeddedResource Include="MainWindow.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
<EmbeddedResource Include="TestItemView.xaml" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
||||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project> |
|
||||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
<ProjectReference Condition="'$(TargetFramework)'=='netcoreapp2.0'" Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" /> |
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
<ProjectReference Condition="'$(TargetFramework)'=='net461'" Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
||||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|
||||
<Name>Avalonia.Markup.Xaml</Name> |
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" /> |
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
||||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj" /> |
||||
<Name>Avalonia.Markup</Name> |
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
||||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj" /> |
||||
<Name>Avalonia.Animation</Name> |
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> |
||||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
||||
<Name>Avalonia.Base</Name> |
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
||||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|
||||
<Name>Avalonia.Controls</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
|
||||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|
||||
<Name>Avalonia.DesignerSupport</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj"> |
|
||||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
|
||||
<Name>Avalonia.Diagnostics</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|
||||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|
||||
<Name>Avalonia.Input</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|
||||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|
||||
<Name>Avalonia.Interactivity</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|
||||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|
||||
<Name>Avalonia.Layout</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|
||||
<Project>{b61b66a3-b82d-4875-8001-89d3394fe0c9}</Project> |
|
||||
<Name>Avalonia.Logging.Serilog</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"> |
|
||||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|
||||
<Name>Avalonia.ReactiveUI</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|
||||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|
||||
<Name>Avalonia.Visuals</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|
||||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|
||||
<Name>Avalonia.Styling</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|
||||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|
||||
<Name>Avalonia.Themes.Default</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'"> |
|
||||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|
||||
<Name>Avalonia.Direct2D1</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'"> |
|
||||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|
||||
<Name>Avalonia.Win32</Name> |
|
||||
</ProjectReference> |
|
||||
</ItemGroup> |
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
<Import Project="..\..\build\SampleApp.props" /> |
||||
|
<Import Project="..\..\build\EmbedXaml.props" /> |
||||
<Import Project="..\..\build\Serilog.props" /> |
<Import Project="..\..\build\Serilog.props" /> |
||||
<Import Project="..\..\build\Rx.props" /> |
<Import Project="..\..\build\Rx.props" /> |
||||
<Import Project="..\..\build\ReactiveUI.props" /> |
<Import Project="..\..\build\ReactiveUI.props" /> |
||||
|
|||||
@ -1,36 +0,0 @@ |
|||||
using System.Reflection; |
|
||||
using System.Runtime.CompilerServices; |
|
||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
// General Information about an assembly is controlled through the following
|
|
||||
// set of attributes. Change these attribute values to modify the information
|
|
||||
// associated with an assembly.
|
|
||||
[assembly: AssemblyTitle("BindingTest")] |
|
||||
[assembly: AssemblyDescription("")] |
|
||||
[assembly: AssemblyConfiguration("")] |
|
||||
[assembly: AssemblyCompany("")] |
|
||||
[assembly: AssemblyProduct("BindingTest")] |
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")] |
|
||||
[assembly: AssemblyTrademark("")] |
|
||||
[assembly: AssemblyCulture("")] |
|
||||
|
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||
// to COM components. If you need to access a type in this assembly from
|
|
||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||
[assembly: ComVisible(false)] |
|
||||
|
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||
[assembly: Guid("08b3e6b9-1cd5-443c-9f61-6d49d1c5f162")] |
|
||||
|
|
||||
// Version information for an assembly consists of the following four values:
|
|
||||
//
|
|
||||
// Major Version
|
|
||||
// Minor Version
|
|
||||
// Build Number
|
|
||||
// Revision
|
|
||||
//
|
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||
// by using the '*' as shown below:
|
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||
[assembly: AssemblyVersion("1.0.0.0")] |
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|
||||
@ -1,138 +1,21 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<Project ToolsVersion="15.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')" /> |
|
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<OutputType>Exe</OutputType> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
<TargetFramework>net461</TargetFramework> |
||||
<ProjectGuid>{2B888490-D14A-4BCA-AB4B-48676FA93C9B}</ProjectGuid> |
|
||||
<OutputType>WinExe</OutputType> |
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
||||
<RootNamespace>ControlCatalog.Desktop</RootNamespace> |
|
||||
<AssemblyName>ControlCatalog.Desktop</AssemblyName> |
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|
||||
<FileAlignment>512</FileAlignment> |
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
||||
<TargetFrameworkProfile /> |
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
||||
<PlatformTarget>x86</PlatformTarget> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup> |
|
||||
<StartupObject /> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<Reference Include="System" /> |
|
||||
<Reference Include="System.Core" /> |
|
||||
<Reference Include="System.Xml.Linq" /> |
|
||||
<Reference Include="System.Data.DataSetExtensions" /> |
|
||||
<Reference Include="Microsoft.CSharp" /> |
|
||||
<Reference Include="System.Data" /> |
|
||||
<Reference Include="System.Net.Http" /> |
|
||||
<Reference Include="System.Xml" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<Compile Include="Program.cs" /> |
|
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<None Include="App.config" /> |
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
||||
|
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
|
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
<Folder Include="Properties\" /> |
||||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|
||||
<Name>Avalonia.DesignerSupport</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|
||||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project> |
|
||||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Gtk\Avalonia.Gtk3\Avalonia.Gtk3.csproj"> |
|
||||
<Project>{bb1f7bb5-6ad4-4776-94d9-c09d0a972658}</Project> |
|
||||
<Name>Avalonia.Gtk3</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|
||||
<Project>{3E53A01A-B331-47F3-B828-4A5717E77A24}</Project> |
|
||||
<Name>Avalonia.Markup.Xaml</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|
||||
<Project>{6417E941-21BC-467B-A771-0DE389353CE6}</Project> |
|
||||
<Name>Avalonia.Markup</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
|
||||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|
||||
<Name>Avalonia.Animation</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
|
||||
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project> |
|
||||
<Name>Avalonia.Base</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|
||||
<Project>{D2221C82-4A25-4583-9B43-D791E3F6820C}</Project> |
|
||||
<Name>Avalonia.Controls</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|
||||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|
||||
<Name>Avalonia.Input</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|
||||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|
||||
<Name>Avalonia.Interactivity</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|
||||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|
||||
<Name>Avalonia.Layout</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|
||||
<Project>{B61B66A3-B82D-4875-8001-89D3394FE0C9}</Project> |
|
||||
<Name>Avalonia.Logging.Serilog</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|
||||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|
||||
<Name>Avalonia.Visuals</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|
||||
<Project>{F1BAA01A-F176-4C6A-B39D-5B40BB1B148F}</Project> |
|
||||
<Name>Avalonia.Styling</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|
||||
<Project>{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}</Project> |
|
||||
<Name>Avalonia.Themes.Default</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj"> |
|
||||
<Project>{7d2d3083-71dd-4cc9-8907-39a0d86fb322}</Project> |
|
||||
<Name>Avalonia.Skia</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'"> |
|
||||
<Project>{3E908F67-5543-4879-A1DC-08EACE79B3CD}</Project> |
|
||||
<Name>Avalonia.Direct2D1</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'"> |
|
||||
<Project>{811A76CF-1CF6-440F-963B-BBE31BD72A82}</Project> |
|
||||
<Name>Avalonia.Win32</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj"> |
|
||||
<Project>{d0a739b9-3c68-4ba6-a328-41606954b6bd}</Project> |
|
||||
<Name>ControlCatalog</Name> |
|
||||
</ProjectReference> |
|
||||
</ItemGroup> |
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
||||
|
<Import Project="..\..\build\SampleApp.props" /> |
||||
<Import Project="..\..\build\Serilog.props" /> |
<Import Project="..\..\build\Serilog.props" /> |
||||
<Import Project="..\..\build\SkiaSharp.props" /> |
|
||||
</Project> |
</Project> |
||||
@ -1,36 +0,0 @@ |
|||||
using System.Reflection; |
|
||||
using System.Runtime.CompilerServices; |
|
||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
// General Information about an assembly is controlled through the following
|
|
||||
// set of attributes. Change these attribute values to modify the information
|
|
||||
// associated with an assembly.
|
|
||||
[assembly: AssemblyTitle("ControlCatalog.Desktop")] |
|
||||
[assembly: AssemblyDescription("")] |
|
||||
[assembly: AssemblyConfiguration("")] |
|
||||
[assembly: AssemblyCompany("")] |
|
||||
[assembly: AssemblyProduct("ControlCatalog.Desktop")] |
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|
||||
[assembly: AssemblyTrademark("")] |
|
||||
[assembly: AssemblyCulture("")] |
|
||||
|
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||
// to COM components. If you need to access a type in this assembly from
|
|
||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||
[assembly: ComVisible(false)] |
|
||||
|
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||
[assembly: Guid("2b888490-d14a-4bca-ab4b-48676fa93c9b")] |
|
||||
|
|
||||
// Version information for an assembly consists of the following four values:
|
|
||||
//
|
|
||||
// Major Version
|
|
||||
// Minor Version
|
|
||||
// Build Number
|
|
||||
// Revision
|
|
||||
//
|
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||
// by using the '*' as shown below:
|
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||
[assembly: AssemblyVersion("1.0.0.0")] |
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|
||||
@ -1,6 +1,6 @@ |
|||||
<Window xmlns="https://github.com/avaloniaui" MinWidth="500" MinHeight="300" |
<Window xmlns="https://github.com/avaloniaui" MinWidth="500" MinHeight="300" |
||||
Title="Avalonia Control Gallery" |
Title="Avalonia Control Gallery" |
||||
Icon="resm:ControlCatalog.Assets.test_icon.ico?assembly=ControlCatalog" |
Icon="resm:ControlCatalog.Assets.test_icon.ico?assembly=ControlCatalog" |
||||
xmlns:local="clr-namespace:ControlCatalog;assembly=ControlCatalog"> |
xmlns:local="clr-namespace:ControlCatalog"> |
||||
<local:MainView/> |
<local:MainView/> |
||||
</Window> |
</Window> |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Project> |
||||
|
<Import Project="..\build\SharedVersion.props" /> |
||||
|
</Project> |
||||
@ -1,36 +0,0 @@ |
|||||
using System.Reflection; |
|
||||
using System.Runtime.CompilerServices; |
|
||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
// General Information about an assembly is controlled through the following
|
|
||||
// set of attributes. Change these attribute values to modify the information
|
|
||||
// associated with an assembly.
|
|
||||
[assembly: AssemblyTitle("RenderTest")] |
|
||||
[assembly: AssemblyDescription("")] |
|
||||
[assembly: AssemblyConfiguration("")] |
|
||||
[assembly: AssemblyCompany("")] |
|
||||
[assembly: AssemblyProduct("RenderTest")] |
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|
||||
[assembly: AssemblyTrademark("")] |
|
||||
[assembly: AssemblyCulture("")] |
|
||||
|
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||
// to COM components. If you need to access a type in this assembly from
|
|
||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||
[assembly: ComVisible(false)] |
|
||||
|
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||
[assembly: Guid("f1fdc5b0-4654-416f-ae69-e3e9bbd87801")] |
|
||||
|
|
||||
// Version information for an assembly consists of the following four values:
|
|
||||
//
|
|
||||
// Major Version
|
|
||||
// Minor Version
|
|
||||
// Build Number
|
|
||||
// Revision
|
|
||||
//
|
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||
// by using the '*' as shown below:
|
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||
[assembly: AssemblyVersion("1.0.0.0")] |
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|
||||
@ -1,184 +1,33 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<Project ToolsVersion="15.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')" /> |
|
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<OutputType>Exe</OutputType> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
||||
<ProjectGuid>{F1FDC5B0-4654-416F-AE69-E3E9BBD87801}</ProjectGuid> |
|
||||
<OutputType>WinExe</OutputType> |
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
||||
<RootNamespace>RenderTest</RootNamespace> |
|
||||
<AssemblyName>RenderTest</AssemblyName> |
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|
||||
<FileAlignment>512</FileAlignment> |
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
||||
<TargetFrameworkProfile /> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup> |
|
||||
<StartupObject /> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<Reference Include="System" /> |
|
||||
<Reference Include="System.Core" /> |
|
||||
<Reference Include="System.Xml.Linq" /> |
|
||||
<Reference Include="System.Data.DataSetExtensions" /> |
|
||||
<Reference Include="Microsoft.CSharp" /> |
|
||||
<Reference Include="System.Data" /> |
|
||||
<Reference Include="System.Net.Http" /> |
|
||||
<Reference Include="System.Xml" /> |
|
||||
<Reference Include="WindowsBase" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<Compile Include="App.xaml.cs"> |
|
||||
<DependentUpon>App.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="Pages\DrawingPage.xaml.cs"> |
|
||||
<DependentUpon>DrawingPage.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="Pages\ClippingPage.xaml.cs"> |
|
||||
<DependentUpon>ClippingPage.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="Pages\AnimationsPage.xaml.cs"> |
|
||||
<DependentUpon>AnimationsPage.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="Program.cs" /> |
|
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
||||
<Compile Include="MainWindow.xaml.cs"> |
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<None Include="App.config" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="App.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
||||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|
||||
<Name>Avalonia.Animation</Name> |
<ProjectReference Condition="'$(TargetFramework)'=='netcoreapp2.0'" Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" /> |
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
<ProjectReference Condition="'$(TargetFramework)'=='net461'" Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
||||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|
||||
<Name>Avalonia.Base</Name> |
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
||||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj" /> |
||||
<Name>Avalonia.Controls</Name> |
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
||||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj" /> |
||||
<Name>Avalonia.DesignerSupport</Name> |
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> |
||||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
||||
<Name>Avalonia.Diagnostics</Name> |
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj" /> |
||||
</ProjectReference> |
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
||||
<Project>{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}</Project> |
</ItemGroup> |
||||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
<Import Project="..\..\build\SampleApp.props" /> |
||||
</ProjectReference> |
<Import Project="..\..\build\EmbedXaml.props" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|
||||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|
||||
<Name>Avalonia.Input</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|
||||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|
||||
<Name>Avalonia.Interactivity</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|
||||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|
||||
<Name>Avalonia.Layout</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|
||||
<Project>{b61b66a3-b82d-4875-8001-89d3394fe0c9}</Project> |
|
||||
<Name>Avalonia.Logging.Serilog</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"> |
|
||||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|
||||
<Name>Avalonia.ReactiveUI</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|
||||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|
||||
<Name>Avalonia.Visuals</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|
||||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|
||||
<Name>Avalonia.Styling</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|
||||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|
||||
<Name>Avalonia.Themes.Default</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|
||||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|
||||
<Name>Avalonia.Markup.Xaml</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|
||||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
|
||||
<Name>Avalonia.Markup</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj"> |
|
||||
<Project>{7d2d3083-71dd-4cc9-8907-39a0d86fb322}</Project> |
|
||||
<Name>Avalonia.Skia</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj"> |
|
||||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|
||||
<Name>Avalonia.Direct2D1</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj"> |
|
||||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|
||||
<Name>Avalonia.Win32</Name> |
|
||||
</ProjectReference> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="MainWindow.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="SideBar.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="Pages\AnimationsPage.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="Pages\ClippingPage.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="Pages\DrawingPage.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
||||
<Import Project="..\..\build\Serilog.props" /> |
<Import Project="..\..\build\Serilog.props" /> |
||||
<Import Project="..\..\build\Rx.props" /> |
<Import Project="..\..\build\Rx.props" /> |
||||
<Import Project="..\..\build\ReactiveUI.props" /> |
<Import Project="..\..\build\ReactiveUI.props" /> |
||||
|
|||||
@ -1,36 +0,0 @@ |
|||||
using System.Reflection; |
|
||||
using System.Runtime.CompilerServices; |
|
||||
using System.Runtime.InteropServices; |
|
||||
|
|
||||
// General Information about an assembly is controlled through the following
|
|
||||
// set of attributes. Change these attribute values to modify the information
|
|
||||
// associated with an assembly.
|
|
||||
[assembly: AssemblyTitle("VirtualizationTest")] |
|
||||
[assembly: AssemblyDescription("")] |
|
||||
[assembly: AssemblyConfiguration("")] |
|
||||
[assembly: AssemblyCompany("")] |
|
||||
[assembly: AssemblyProduct("VirtualizationTest")] |
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")] |
|
||||
[assembly: AssemblyTrademark("")] |
|
||||
[assembly: AssemblyCulture("")] |
|
||||
|
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||
// to COM components. If you need to access a type in this assembly from
|
|
||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||
[assembly: ComVisible(false)] |
|
||||
|
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||
[assembly: Guid("fbcaf3d0-2808-4934-8e96-3f607594517b")] |
|
||||
|
|
||||
// Version information for an assembly consists of the following four values:
|
|
||||
//
|
|
||||
// Major Version
|
|
||||
// Minor Version
|
|
||||
// Build Number
|
|
||||
// Revision
|
|
||||
//
|
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||
// by using the '*' as shown below:
|
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||
[assembly: AssemblyVersion("1.0.0.0")] |
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|
||||
@ -1,151 +1,33 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<Project ToolsVersion="15.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')" /> |
|
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
<OutputType>Exe</OutputType> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> |
||||
<ProjectGuid>{FBCAF3D0-2808-4934-8E96-3F607594517B}</ProjectGuid> |
|
||||
<OutputType>WinExe</OutputType> |
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
||||
<RootNamespace>VirtualizationTest</RootNamespace> |
|
||||
<AssemblyName>VirtualizationTest</AssemblyName> |
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> |
|
||||
<FileAlignment>512</FileAlignment> |
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
||||
<TargetFrameworkProfile /> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup> |
|
||||
<StartupObject /> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<Reference Include="System" /> |
|
||||
<Reference Include="System.Core" /> |
|
||||
<Reference Include="System.Xml.Linq" /> |
|
||||
<Reference Include="System.Data.DataSetExtensions" /> |
|
||||
<Reference Include="Microsoft.CSharp" /> |
|
||||
<Reference Include="System.Data" /> |
|
||||
<Reference Include="System.Net.Http" /> |
|
||||
<Reference Include="System.Xml" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<Compile Include="App.xaml.cs"> |
|
||||
<DependentUpon>App.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="MainWindow.xaml.cs"> |
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon> |
|
||||
</Compile> |
|
||||
<Compile Include="Program.cs" /> |
|
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
||||
<Compile Include="ViewModels\ItemViewModel.cs" /> |
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<None Include="App.config" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj"> |
|
||||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|
||||
<Name>Avalonia.Animation</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj"> |
|
||||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|
||||
<Name>Avalonia.Base</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj"> |
|
||||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|
||||
<Name>Avalonia.Controls</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj"> |
|
||||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|
||||
<Name>Avalonia.DesignerSupport</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj"> |
|
||||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
|
||||
<Name>Avalonia.Diagnostics</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj"> |
|
||||
<Project>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</Project> |
|
||||
<Name>Avalonia.DotNetFrameworkRuntime</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj"> |
|
||||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|
||||
<Name>Avalonia.Input</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj"> |
|
||||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|
||||
<Name>Avalonia.Interactivity</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj"> |
|
||||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|
||||
<Name>Avalonia.Layout</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj"> |
|
||||
<Project>{B61B66A3-B82D-4875-8001-89D3394FE0C9}</Project> |
|
||||
<Name>Avalonia.Logging.Serilog</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj"> |
|
||||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|
||||
<Name>Avalonia.ReactiveUI</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|
||||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|
||||
<Name>Avalonia.Visuals</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj"> |
|
||||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|
||||
<Name>Avalonia.Styling</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj"> |
|
||||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|
||||
<Name>Avalonia.Themes.Default</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj"> |
|
||||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|
||||
<Name>Avalonia.Markup.Xaml</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj"> |
|
||||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
|
||||
<Name>Avalonia.Markup</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" Condition="'$(Platform)'!='Mono'"> |
|
||||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|
||||
<Name>Avalonia.Direct2D1</Name> |
|
||||
</ProjectReference> |
|
||||
<ProjectReference Include="..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" Condition="'$(Platform)'!='Mono'"> |
|
||||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|
||||
<Name>Avalonia.Win32</Name> |
|
||||
</ProjectReference> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="App.xaml"> |
|
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<EmbeddedResource Include="MainWindow.xaml"> |
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" /> |
||||
<SubType>Designer</SubType> |
|
||||
</EmbeddedResource> |
<ProjectReference Condition="'$(TargetFramework)'=='netcoreapp2.0'" Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" /> |
||||
|
|
||||
|
<ProjectReference Condition="'$(TargetFramework)'=='net461'" Include="..\..\src\Avalonia.DotNetFrameworkRuntime\Avalonia.DotNetFrameworkRuntime.csproj" /> |
||||
|
|
||||
|
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml\Avalonia.Markup.Xaml.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup\Avalonia.Markup.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Animation\Avalonia.Animation.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Controls\Avalonia.Controls.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Input\Avalonia.Input.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Interactivity\Avalonia.Interactivity.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Layout\Avalonia.Layout.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Styling\Avalonia.Styling.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Logging.Serilog\Avalonia.Logging.Serilog.csproj" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
<Import Project="..\..\build\SampleApp.props" /> |
||||
|
<Import Project="..\..\build\EmbedXaml.props" /> |
||||
<Import Project="..\..\build\Serilog.props" /> |
<Import Project="..\..\build\Serilog.props" /> |
||||
<Import Project="..\..\build\Rx.props" /> |
<Import Project="..\..\build\Rx.props" /> |
||||
<Import Project="..\..\build\ReactiveUI.props" /> |
<Import Project="..\..\build\ReactiveUI.props" /> |
||||
|
|||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Animation")] |
|
||||
@ -1,36 +1,9 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
<TargetFramework>netstandard2.0</TargetFramework> |
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> |
<AssemblyName>Avalonia.Base</AssemblyName> |
||||
<RootNamespace>Avalonia</RootNamespace> |
<RootNamespace>Avalonia</RootNamespace> |
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Debug\Avalonia.Base.xml</DocumentationFile> |
|
||||
<NoWarn>CS1591</NoWarn> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Release\Avalonia.Base.xml</DocumentationFile> |
|
||||
<NoWarn>CS1591</NoWarn> |
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<Compile Include="..\Shared\SharedAssemblyInfo.cs"> |
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link> |
|
||||
</Compile> |
|
||||
</ItemGroup> |
|
||||
<Import Project="..\..\build\Base.props" /> |
<Import Project="..\..\build\Base.props" /> |
||||
<Import Project="..\..\build\Rx.props" /> |
<Import Project="..\..\build\Rx.props" /> |
||||
<Import Project="..\..\build\JetBrains.Annotations.props" /> |
<Import Project="..\..\build\JetBrains.Annotations.props" /> |
||||
|
|||||
@ -0,0 +1,700 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Diagnostics; |
||||
|
using System.Globalization; |
||||
|
using System.Linq; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using Avalonia.Layout; |
||||
|
using JetBrains.Annotations; |
||||
|
|
||||
|
namespace Avalonia.Controls.Utils |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Contains algorithms that can help to measure and arrange a Grid.
|
||||
|
/// </summary>
|
||||
|
internal class GridLayout |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Initialize a new <see cref="GridLayout"/> instance from the column definitions.
|
||||
|
/// The instance doesn't care about whether the definitions are rows or columns.
|
||||
|
/// It will not calculate the column or row differently.
|
||||
|
/// </summary>
|
||||
|
internal GridLayout([NotNull] ColumnDefinitions columns) |
||||
|
{ |
||||
|
if (columns == null) throw new ArgumentNullException(nameof(columns)); |
||||
|
_conventions = columns.Count == 0 |
||||
|
? new List<LengthConvention> { new LengthConvention() } |
||||
|
: columns.Select(x => new LengthConvention(x.Width, x.MinWidth, x.MaxWidth)).ToList(); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Initialize a new <see cref="GridLayout"/> instance from the row definitions.
|
||||
|
/// The instance doesn't care about whether the definitions are rows or columns.
|
||||
|
/// It will not calculate the column or row differently.
|
||||
|
/// </summary>
|
||||
|
internal GridLayout([NotNull] RowDefinitions rows) |
||||
|
{ |
||||
|
if (rows == null) throw new ArgumentNullException(nameof(rows)); |
||||
|
_conventions = rows.Count == 0 |
||||
|
? new List<LengthConvention> { new LengthConvention() } |
||||
|
: rows.Select(x => new LengthConvention(x.Height, x.MinHeight, x.MaxHeight)).ToList(); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the layout tolerance. If any length offset is less than this value, we will treat them the same.
|
||||
|
/// </summary>
|
||||
|
private const double LayoutTolerance = 1.0 / 256.0; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets all the length conventions that come from column/row definitions.
|
||||
|
/// These conventions provide cell limitations, such as the expected pixel length, the min/max pixel length and the * count.
|
||||
|
/// </summary>
|
||||
|
[NotNull] |
||||
|
private readonly List<LengthConvention> _conventions; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets all the length conventions that come from the grid children.
|
||||
|
/// </summary>
|
||||
|
[NotNull] |
||||
|
private readonly List<AdditionalLengthConvention> _additionalConventions = |
||||
|
new List<AdditionalLengthConvention>(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Appending these elements into the convention list helps lay them out according to their desired sizes.
|
||||
|
/// <para/>
|
||||
|
/// Some elements are not only in a single grid cell, they have one or more column/row spans,
|
||||
|
/// and these elements may affect the grid layout especially the measuring procedure.<para/>
|
||||
|
/// Append these elements into the convention list can help to layout them correctly through
|
||||
|
/// their desired size. Only a small subset of children need to be measured before layout starts
|
||||
|
/// and they will be called via the<paramref name="getDesiredLength"/> callback.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="T">The grid children type.</typeparam>
|
||||
|
/// <param name="source">
|
||||
|
/// Contains the safe column/row index and its span.
|
||||
|
/// Notice that we will not verify whether the range is in the column/row count,
|
||||
|
/// so you should get the safe column/row info first.
|
||||
|
/// </param>
|
||||
|
/// <param name="getDesiredLength">
|
||||
|
/// This callback will be called if the <see cref="GridLayout"/> thinks that a child should be
|
||||
|
/// measured first. Usually, these are the children that have the * or Auto length.
|
||||
|
/// </param>
|
||||
|
internal void AppendMeasureConventions<T>([NotNull] IDictionary<T, (int index, int span)> source, |
||||
|
[NotNull] Func<T, double> getDesiredLength) |
||||
|
{ |
||||
|
if (source == null) throw new ArgumentNullException(nameof(source)); |
||||
|
if (getDesiredLength == null) throw new ArgumentNullException(nameof(getDesiredLength)); |
||||
|
|
||||
|
// M1/7. Find all the Auto and * length columns/rows. (M1/7 means the 1st procedure of measurement.)
|
||||
|
// Only these columns/rows' layout can be affected by the child desired size.
|
||||
|
//
|
||||
|
// Find all columns/rows that have Auto or * length. We'll measure the children in advance.
|
||||
|
// Only these kind of columns/rows will affect the Grid layout.
|
||||
|
// Please note:
|
||||
|
// - If the column / row has Auto length, the Grid.DesiredSize and the column width
|
||||
|
// will be affected by the child's desired size.
|
||||
|
// - If the column / row has* length, the Grid.DesiredSize will be affected by the
|
||||
|
// child's desired size but the column width not.
|
||||
|
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// _conventions: | min | max | | | min | | min max | max |
|
||||
|
// _additionalC: |<- desired ->| |< desired >|
|
||||
|
// _additionalC: |< desired >| |<- desired ->|
|
||||
|
|
||||
|
// 寻找所有行列范围中包含 Auto 和 * 的元素,使用全部可用尺寸提前测量。
|
||||
|
// 因为只有这部分元素的布局才会被 Grid 的子元素尺寸影响。
|
||||
|
// 请注意:
|
||||
|
// - Auto 长度的行列必定会受到子元素布局影响,会影响到行列的布局长度和 Grid 本身的 DesiredSize;
|
||||
|
// - 而对于 * 长度,只有 Grid.DesiredSize 会受到子元素布局影响,而行列长度不会受影响。
|
||||
|
|
||||
|
// Find all the Auto and * length columns/rows.
|
||||
|
var found = new Dictionary<T, (int index, int span)>(); |
||||
|
for (var i = 0; i < _conventions.Count; i++) |
||||
|
{ |
||||
|
var index = i; |
||||
|
var convention = _conventions[index]; |
||||
|
if (convention.Length.IsAuto || convention.Length.IsStar) |
||||
|
{ |
||||
|
foreach (var pair in source.Where(x => |
||||
|
x.Value.index <= index && index < x.Value.index + x.Value.span)) |
||||
|
{ |
||||
|
found[pair.Key] = pair.Value; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Append these layout into the additional convention list.
|
||||
|
foreach (var pair in found) |
||||
|
{ |
||||
|
var t = pair.Key; |
||||
|
var (index, span) = pair.Value; |
||||
|
var desiredLength = getDesiredLength(t); |
||||
|
if (Math.Abs(desiredLength) > LayoutTolerance) |
||||
|
{ |
||||
|
_additionalConventions.Add(new AdditionalLengthConvention(index, span, desiredLength)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Run measure procedure according to the <paramref name="containerLength"/> and gets the <see cref="MeasureResult"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="containerLength">
|
||||
|
/// The container length. Usually, it is the constraint of the <see cref="Layoutable.MeasureOverride"/> method.
|
||||
|
/// </param>
|
||||
|
/// <returns>
|
||||
|
/// The measured result that containing the desired size and all the column/row lengths.
|
||||
|
/// </returns>
|
||||
|
[NotNull, Pure] |
||||
|
internal MeasureResult Measure(double containerLength) |
||||
|
{ |
||||
|
// Prepare all the variables that this method needs to use.
|
||||
|
var conventions = _conventions.Select(x => x.Clone()).ToList(); |
||||
|
var starCount = conventions.Where(x => x.Length.IsStar).Sum(x => x.Length.Value); |
||||
|
var aggregatedLength = 0.0; |
||||
|
double starUnitLength; |
||||
|
|
||||
|
// M2/7. Aggregate all the pixel lengths. Then we can get the remaining length by `containerLength - aggregatedLength`.
|
||||
|
// We mark the aggregated length as "fix" because we can completely determine their values. Same as below.
|
||||
|
//
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// |#fix#| |#fix#|
|
||||
|
//
|
||||
|
// 将全部的固定像素长度的行列长度累加。这样,containerLength - aggregatedLength 便能得到剩余长度。
|
||||
|
// 我们会将所有能够确定下长度的行列标记为 fix。下同。
|
||||
|
// 请注意:
|
||||
|
// - 我们并没有直接从 containerLength 一直减下去,而是使用 aggregatedLength 进行累加,是因为无穷大相减得到的是 NaN,不利于后续计算。
|
||||
|
|
||||
|
aggregatedLength += conventions.Where(x => x.Length.IsAbsolute).Sum(x => x.Length.Value); |
||||
|
|
||||
|
// M3/7. Fix all the * lengths that have reached the minimum.
|
||||
|
//
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | min | max | | | min | | min max | max |
|
||||
|
// | fix | |#fix#| fix |
|
||||
|
|
||||
|
var shouldTestStarMin = true; |
||||
|
while (shouldTestStarMin) |
||||
|
{ |
||||
|
// Calculate the unit * length to estimate the length of each column/row that has * length.
|
||||
|
// Under this estimated length, check if there is a minimum value that has a length less than its constraint.
|
||||
|
// If there is such a *, then fix the size of this cell, and then loop it again until there is no * that can be constrained by the minimum value.
|
||||
|
//
|
||||
|
// 计算单位 * 的长度,以便预估出每一个 * 行列的长度。
|
||||
|
// 在此预估的长度下,从前往后寻找是否存在某个 * 长度已经小于其约束的最小值。
|
||||
|
// 如果发现存在这样的 *,那么将此单元格的尺寸固定下来(Fix),然后循环重来,直至再也没有能被最小值约束的 *。
|
||||
|
var @fixed = false; |
||||
|
starUnitLength = (containerLength - aggregatedLength) / starCount; |
||||
|
foreach (var convention in conventions.Where(x => x.Length.IsStar)) |
||||
|
{ |
||||
|
var (star, min) = (convention.Length.Value, convention.MinLength); |
||||
|
var starLength = star * starUnitLength; |
||||
|
if (starLength < min) |
||||
|
{ |
||||
|
convention.Fix(min); |
||||
|
starLength = min; |
||||
|
aggregatedLength += starLength; |
||||
|
starCount -= star; |
||||
|
@fixed = true; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
shouldTestStarMin = @fixed; |
||||
|
} |
||||
|
|
||||
|
// M4/7. Determine the absolute pixel size of all columns/rows that have an Auto length.
|
||||
|
//
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | min | max | | | min | | min max | max |
|
||||
|
// |#fix#| | fix |#fix#| fix | fix |
|
||||
|
|
||||
|
var shouldTestAuto = true; |
||||
|
while (shouldTestAuto) |
||||
|
{ |
||||
|
var @fixed = false; |
||||
|
starUnitLength = (containerLength - aggregatedLength) / starCount; |
||||
|
for (var i = 0; i < conventions.Count; i++) |
||||
|
{ |
||||
|
var convention = conventions[i]; |
||||
|
if (!convention.Length.IsAuto) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
var more = ApplyAdditionalConventionsForAuto(conventions, i, starUnitLength); |
||||
|
convention.Fix(more); |
||||
|
aggregatedLength += more; |
||||
|
@fixed = true; |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
shouldTestAuto = @fixed; |
||||
|
} |
||||
|
|
||||
|
// M5/7. Expand the stars according to the additional conventions (usually the child desired length).
|
||||
|
// We can't fix this kind of length, so we just mark them as desired (des).
|
||||
|
//
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | min | max | | | min | | min max | max |
|
||||
|
// |#des#| fix |#des#| fix | fix | fix | fix | #des# |#des#|
|
||||
|
|
||||
|
var desiredStarMin = AggregateAdditionalConventionsForStars(conventions); |
||||
|
aggregatedLength += desiredStarMin; |
||||
|
|
||||
|
// M6/7. Determine the desired length of the grid for current container length. Its value is stored in desiredLength.
|
||||
|
// Assume if the container has infinite length, the grid desired length is stored in greedyDesiredLength.
|
||||
|
//
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | min | max | | | min | | min max | max |
|
||||
|
// |#des#| fix |#des#| fix | fix | fix | fix | #des# |#des#|
|
||||
|
// Note: This table will be stored as the intermediate result into the MeasureResult and it will be reused by Arrange procedure.
|
||||
|
//
|
||||
|
// desiredLength = Math.Max(0.0, des + fix + des + fix + fix + fix + fix + des + des)
|
||||
|
// greedyDesiredLength = des + fix + des + fix + fix + fix + fix + des + des
|
||||
|
|
||||
|
var desiredLength = containerLength - aggregatedLength >= 0.0 ? aggregatedLength : containerLength; |
||||
|
var greedyDesiredLength = aggregatedLength; |
||||
|
|
||||
|
// M7/7. Expand all the rest stars. These stars have no conventions or only have
|
||||
|
// max value they can be expanded from zero to constraint.
|
||||
|
//
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | * | A | * | P | A | * | P | * | * |
|
||||
|
// +-----------------------------------------------------------+
|
||||
|
// | min | max | | | min | | min max | max |
|
||||
|
// |#fix#| fix |#fix#| fix | fix | fix | fix | #fix# |#fix#|
|
||||
|
// Note: This table will be stored as the final result into the MeasureResult.
|
||||
|
|
||||
|
var dynamicConvention = ExpandStars(conventions, containerLength); |
||||
|
Clip(dynamicConvention, containerLength); |
||||
|
|
||||
|
// Returns the measuring result.
|
||||
|
return new MeasureResult(containerLength, desiredLength, greedyDesiredLength, |
||||
|
conventions, dynamicConvention); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Run arrange procedure according to the <paramref name="measure"/> and gets the <see cref="ArrangeResult"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="finalLength">
|
||||
|
/// The container length. Usually, it is the finalSize of the <see cref="Layoutable.ArrangeOverride"/> method.
|
||||
|
/// </param>
|
||||
|
/// <param name="measure">
|
||||
|
/// The result that the measuring procedure returns. If it is null, a new measure procedure will run.
|
||||
|
/// </param>
|
||||
|
/// <returns>
|
||||
|
/// The measured result that containing the desired size and all the column/row length.
|
||||
|
/// </returns>
|
||||
|
[NotNull, Pure] |
||||
|
public ArrangeResult Arrange(double finalLength, [CanBeNull] MeasureResult measure) |
||||
|
{ |
||||
|
measure = measure ?? Measure(finalLength); |
||||
|
|
||||
|
// If the arrange final length does not equal to the measure length, we should measure again.
|
||||
|
if (finalLength - measure.ContainerLength > LayoutTolerance) |
||||
|
{ |
||||
|
// If the final length is larger, we will rerun the whole measure.
|
||||
|
measure = Measure(finalLength); |
||||
|
} |
||||
|
else if (finalLength - measure.ContainerLength < -LayoutTolerance) |
||||
|
{ |
||||
|
// If the final length is smaller, we measure the M6/6 procedure only.
|
||||
|
var dynamicConvention = ExpandStars(measure.LeanLengthList, finalLength); |
||||
|
measure = new MeasureResult(finalLength, measure.DesiredLength, measure.GreedyDesiredLength, |
||||
|
measure.LeanLengthList, dynamicConvention); |
||||
|
} |
||||
|
|
||||
|
return new ArrangeResult(measure.LengthList); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Use the <see cref="_additionalConventions"/> to calculate the fixed length of the Auto column/row.
|
||||
|
/// </summary>
|
||||
|
/// <param name="conventions">The convention list that all the * with minimum length are fixed.</param>
|
||||
|
/// <param name="index">The column/row index that should be fixed.</param>
|
||||
|
/// <param name="starUnitLength">The unit * length for the current rest length.</param>
|
||||
|
/// <returns>The final length of the Auto length column/row.</returns>
|
||||
|
[Pure] |
||||
|
private double ApplyAdditionalConventionsForAuto(IReadOnlyList<LengthConvention> conventions, |
||||
|
int index, double starUnitLength) |
||||
|
{ |
||||
|
// 1. Calculate all the * length with starUnitLength.
|
||||
|
// 2. Exclude all the fixed length and all the * length.
|
||||
|
// 3. Compare the rest of the desired length and the convention.
|
||||
|
// +-----------------+
|
||||
|
// | * | A | * |
|
||||
|
// +-----------------+
|
||||
|
// | exl | | exl |
|
||||
|
// |< desired >|
|
||||
|
// |< desired >|
|
||||
|
|
||||
|
var more = 0.0; |
||||
|
foreach (var additional in _additionalConventions) |
||||
|
{ |
||||
|
// If the additional convention's last column/row contains the Auto column/row, try to determine the Auto column/row length.
|
||||
|
if (index == additional.Index + additional.Span - 1) |
||||
|
{ |
||||
|
var min = Enumerable.Range(additional.Index, additional.Span) |
||||
|
.Select(x => |
||||
|
{ |
||||
|
var c = conventions[x]; |
||||
|
if (c.Length.IsAbsolute) return c.Length.Value; |
||||
|
if (c.Length.IsStar) return c.Length.Value * starUnitLength; |
||||
|
return 0.0; |
||||
|
}).Sum(); |
||||
|
more = Math.Max(additional.Min - min, more); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return Math.Min(conventions[index].MaxLength, more); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Calculate the total desired length of all the * length.
|
||||
|
/// Bug Warning:
|
||||
|
/// - The behavior of this method is undefined! Different UI Frameworks have different behaviors.
|
||||
|
/// - We ignore all the span columns/rows and just take single cells into consideration.
|
||||
|
/// </summary>
|
||||
|
/// <param name="conventions">All the conventions that have almost been fixed except the rest *.</param>
|
||||
|
/// <returns>The total desired length of all the * length.</returns>
|
||||
|
[Pure, MethodImpl(MethodImplOptions.AggressiveInlining)] |
||||
|
private double AggregateAdditionalConventionsForStars( |
||||
|
IReadOnlyList<LengthConvention> conventions) |
||||
|
{ |
||||
|
// 1. Determine all one-span column's desired widths or row's desired heights.
|
||||
|
// 2. Order the multi-span conventions by its last index
|
||||
|
// (Notice that the sorted data is much smaller than the source.)
|
||||
|
// 3. Determine each multi-span last index by calculating the maximun desired size.
|
||||
|
|
||||
|
// Before we determine the behavior of this method, we just aggregate the one-span * columns.
|
||||
|
|
||||
|
var fixedLength = conventions.Where(x => x.Length.IsAbsolute).Sum(x => x.Length.Value); |
||||
|
|
||||
|
// Prepare a lengthList variable indicating the fixed length of each column/row.
|
||||
|
var lengthList = conventions.Select(x => x.Length.IsAbsolute ? x.Length.Value : 0.0).ToList(); |
||||
|
foreach (var group in _additionalConventions |
||||
|
.Where(x => x.Span == 1 && conventions[x.Index].Length.IsStar) |
||||
|
.ToLookup(x => x.Index)) |
||||
|
{ |
||||
|
lengthList[group.Key] = Math.Max(lengthList[group.Key], group.Max(x => x.Min)); |
||||
|
} |
||||
|
|
||||
|
// Now the lengthList is fixed by every one-span columns/rows.
|
||||
|
// Then we should determine the multi-span column's/row's length.
|
||||
|
foreach (var group in _additionalConventions |
||||
|
.Where(x => x.Span > 1) |
||||
|
.ToLookup(x => x.Index + x.Span - 1) |
||||
|
// Order the multi-span columns/rows by last index.
|
||||
|
.OrderBy(x => x.Key)) |
||||
|
{ |
||||
|
var length = group.Max(x => x.Min - Enumerable.Range(x.Index, x.Span - 1).Sum(r => lengthList[r])); |
||||
|
lengthList[group.Key] = Math.Max(lengthList[group.Key], length > 0 ? length : 0); |
||||
|
} |
||||
|
|
||||
|
return lengthList.Sum() - fixedLength; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// This method implements the last procedure (M7/7) of measure.
|
||||
|
/// It expands all the * length to the fixed length according to the <paramref name="constraint"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="conventions">All the conventions that have almost been fixed except the remaining *.</param>
|
||||
|
/// <param name="constraint">The container length.</param>
|
||||
|
/// <returns>The final pixel length list.</returns>
|
||||
|
[Pure] |
||||
|
private static List<double> ExpandStars(IEnumerable<LengthConvention> conventions, double constraint) |
||||
|
{ |
||||
|
// Initial.
|
||||
|
var dynamicConvention = conventions.Select(x => x.Clone()).ToList(); |
||||
|
constraint -= dynamicConvention.Where(x => x.Length.IsAbsolute).Sum(x => x.Length.Value); |
||||
|
var starUnitLength = 0.0; |
||||
|
|
||||
|
// M6/6.
|
||||
|
if (constraint >= 0) |
||||
|
{ |
||||
|
var starCount = dynamicConvention.Where(x => x.Length.IsStar).Sum(x => x.Length.Value); |
||||
|
|
||||
|
var shouldTestStarMax = true; |
||||
|
while (shouldTestStarMax) |
||||
|
{ |
||||
|
var @fixed = false; |
||||
|
starUnitLength = constraint / starCount; |
||||
|
foreach (var convention in dynamicConvention.Where(x => |
||||
|
x.Length.IsStar && !double.IsPositiveInfinity(x.MaxLength))) |
||||
|
{ |
||||
|
var (star, max) = (convention.Length.Value, convention.MaxLength); |
||||
|
var starLength = star * starUnitLength; |
||||
|
if (starLength > max) |
||||
|
{ |
||||
|
convention.Fix(max); |
||||
|
starLength = max; |
||||
|
constraint -= starLength; |
||||
|
starCount -= star; |
||||
|
@fixed = true; |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
shouldTestStarMax = @fixed; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Debug.Assert(dynamicConvention.All(x => !x.Length.IsAuto)); |
||||
|
|
||||
|
var starUnit = starUnitLength; |
||||
|
var result = dynamicConvention.Select(x => |
||||
|
{ |
||||
|
if (x.Length.IsStar) |
||||
|
{ |
||||
|
return double.IsInfinity(starUnit) ? double.PositiveInfinity : starUnit * x.Length.Value; |
||||
|
} |
||||
|
|
||||
|
return x.Length.Value; |
||||
|
}).ToList(); |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// If the container length is not infinity. It may be not enough to contain all the columns/rows.
|
||||
|
/// We should clip the columns/rows that have been out of the container bounds.
|
||||
|
/// Note: This method may change the items value of <paramref name="lengthList"/>.
|
||||
|
/// </summary>
|
||||
|
/// <param name="lengthList">A list of all the column widths and row heights with a fixed pixel length</param>
|
||||
|
/// <param name="constraint">the container length. It can be positive infinity.</param>
|
||||
|
private static void Clip([NotNull] IList<double> lengthList, double constraint) |
||||
|
{ |
||||
|
if (double.IsInfinity(constraint)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var measureLength = 0.0; |
||||
|
for (var i = 0; i < lengthList.Count; i++) |
||||
|
{ |
||||
|
var length = lengthList[i]; |
||||
|
if (constraint - measureLength > length) |
||||
|
{ |
||||
|
measureLength += length; |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
lengthList[i] = constraint - measureLength; |
||||
|
measureLength = constraint; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Contains the convention of each column/row.
|
||||
|
/// This is mostly the same as <see cref="RowDefinition"/> or <see cref="ColumnDefinition"/>.
|
||||
|
/// We use this because we can treat the column and the row the same.
|
||||
|
/// </summary>
|
||||
|
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] |
||||
|
internal class LengthConvention : ICloneable |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Initialize a new instance of <see cref="LengthConvention"/>.
|
||||
|
/// </summary>
|
||||
|
public LengthConvention() |
||||
|
{ |
||||
|
Length = new GridLength(1.0, GridUnitType.Star); |
||||
|
MinLength = 0.0; |
||||
|
MaxLength = double.PositiveInfinity; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Initialize a new instance of <see cref="LengthConvention"/>.
|
||||
|
/// </summary>
|
||||
|
public LengthConvention(GridLength length, double minLength, double maxLength) |
||||
|
{ |
||||
|
Length = length; |
||||
|
MinLength = minLength; |
||||
|
MaxLength = maxLength; |
||||
|
if (length.IsAbsolute) |
||||
|
{ |
||||
|
_isFixed = true; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the <see cref="GridLength"/> of a column or a row.
|
||||
|
/// </summary>
|
||||
|
internal GridLength Length { get; private set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the minimum convention for a column or a row.
|
||||
|
/// </summary>
|
||||
|
internal double MinLength { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the maximum convention for a column or a row.
|
||||
|
/// </summary>
|
||||
|
internal double MaxLength { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Fix the <see cref="LengthConvention"/>.
|
||||
|
/// If all columns/rows are fixed, we can get the size of all columns/rows in pixels.
|
||||
|
/// </summary>
|
||||
|
/// <param name="pixel">
|
||||
|
/// The pixel length that should be used to fix the convention.
|
||||
|
/// </param>
|
||||
|
/// <exception cref="InvalidOperationException">
|
||||
|
/// If the convention is pixel length, this exception will throw.
|
||||
|
/// </exception>
|
||||
|
public void Fix(double pixel) |
||||
|
{ |
||||
|
if (_isFixed) |
||||
|
{ |
||||
|
throw new InvalidOperationException("Cannot fix the length convention if it is fixed."); |
||||
|
} |
||||
|
|
||||
|
Length = new GridLength(pixel); |
||||
|
_isFixed = true; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets a value that indicates whether this convention is fixed.
|
||||
|
/// </summary>
|
||||
|
private bool _isFixed; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Helps the debugger to display the intermediate column/row calculation result.
|
||||
|
/// </summary>
|
||||
|
private string DebuggerDisplay => |
||||
|
$"{(_isFixed ? Length.Value.ToString(CultureInfo.InvariantCulture) : (Length.GridUnitType == GridUnitType.Auto ? "Auto" : $"{Length.Value}*"))}, ∈[{MinLength}, {MaxLength}]"; |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
object ICloneable.Clone() => Clone(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Get a deep copy of this convention list.
|
||||
|
/// We need this because we want to store some intermediate states.
|
||||
|
/// </summary>
|
||||
|
internal LengthConvention Clone() => new LengthConvention(Length, MinLength, MaxLength); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Contains the convention that comes from the grid children.
|
||||
|
/// Some children span multiple columns or rows, so even a simple column/row can have multiple conventions.
|
||||
|
/// </summary>
|
||||
|
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] |
||||
|
internal struct AdditionalLengthConvention |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Initialize a new instance of <see cref="AdditionalLengthConvention"/>.
|
||||
|
/// </summary>
|
||||
|
public AdditionalLengthConvention(int index, int span, double min) |
||||
|
{ |
||||
|
Index = index; |
||||
|
Span = span; |
||||
|
Min = min; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the start index of this additional convention.
|
||||
|
/// </summary>
|
||||
|
public int Index { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the span of this additional convention.
|
||||
|
/// </summary>
|
||||
|
public int Span { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the minimum length of this additional convention.
|
||||
|
/// This value is usually provided by the child's desired length.
|
||||
|
/// </summary>
|
||||
|
public double Min { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Helps the debugger to display the intermediate column/row calculation result.
|
||||
|
/// </summary>
|
||||
|
private string DebuggerDisplay => |
||||
|
$"{{{string.Join(",", Enumerable.Range(Index, Span))}}}, ∈[{Min},∞)"; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Stores the result of the measuring procedure.
|
||||
|
/// This result can be used to measure children and assign the desired size.
|
||||
|
/// Passing this result to <see cref="Arrange"/> can reduce calculation.
|
||||
|
/// </summary>
|
||||
|
[DebuggerDisplay("{" + nameof(LengthList) + ",nq}")] |
||||
|
internal class MeasureResult |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Initialize a new instance of <see cref="MeasureResult"/>.
|
||||
|
/// </summary>
|
||||
|
internal MeasureResult(double containerLength, double desiredLength, double greedyDesiredLength, |
||||
|
IReadOnlyList<LengthConvention> leanConventions, IReadOnlyList<double> expandedConventions) |
||||
|
{ |
||||
|
ContainerLength = containerLength; |
||||
|
DesiredLength = desiredLength; |
||||
|
GreedyDesiredLength = greedyDesiredLength; |
||||
|
LeanLengthList = leanConventions; |
||||
|
LengthList = expandedConventions; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the container length for this result.
|
||||
|
/// This property will be used by <see cref="Arrange"/> to determine whether to measure again or not.
|
||||
|
/// </summary>
|
||||
|
public double ContainerLength { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the desired length of this result.
|
||||
|
/// Just return this value as the desired size in <see cref="Layoutable.MeasureOverride"/>.
|
||||
|
/// </summary>
|
||||
|
public double DesiredLength { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the desired length if the container has infinite length.
|
||||
|
/// </summary>
|
||||
|
public double GreedyDesiredLength { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Contains the column/row calculation intermediate result.
|
||||
|
/// This value is used by <see cref="Arrange"/> for reducing repeat calculation.
|
||||
|
/// </summary>
|
||||
|
public IReadOnlyList<LengthConvention> LeanLengthList { get; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the length list for each column/row.
|
||||
|
/// </summary>
|
||||
|
public IReadOnlyList<double> LengthList { get; } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Stores the result of the measuring procedure.
|
||||
|
/// This result can be used to arrange children and assign the render size.
|
||||
|
/// </summary>
|
||||
|
[DebuggerDisplay("{" + nameof(LengthList) + ",nq}")] |
||||
|
internal class ArrangeResult |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Initialize a new instance of <see cref="ArrangeResult"/>.
|
||||
|
/// </summary>
|
||||
|
internal ArrangeResult(IReadOnlyList<double> lengthList) |
||||
|
{ |
||||
|
LengthList = lengthList; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the length list for each column/row.
|
||||
|
/// </summary>
|
||||
|
public IReadOnlyList<double> LengthList { get; } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,8 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
using Avalonia.Metadata; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Application")] |
|
||||
[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Avalonia")] |
|
||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Diagnostics")] |
|
||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.DotNetCoreRuntime")] |
|
||||
@ -1,17 +1,40 @@ |
|||||
using Avalonia.Interactivity; |
using System; |
||||
|
using Avalonia.Interactivity; |
||||
|
using Avalonia.VisualTree; |
||||
|
|
||||
namespace Avalonia.Input |
namespace Avalonia.Input |
||||
{ |
{ |
||||
public class DragEventArgs : RoutedEventArgs |
public class DragEventArgs : RoutedEventArgs |
||||
{ |
{ |
||||
|
private Interactive _target; |
||||
|
private Point _targetLocation; |
||||
|
|
||||
public DragDropEffects DragEffects { get; set; } |
public DragDropEffects DragEffects { get; set; } |
||||
|
|
||||
public IDataObject Data { get; private set; } |
public IDataObject Data { get; private set; } |
||||
|
|
||||
public DragEventArgs(RoutedEvent<DragEventArgs> routedEvent, IDataObject data) |
public Point GetPosition(IVisual relativeTo) |
||||
|
{ |
||||
|
var point = new Point(0, 0); |
||||
|
|
||||
|
if (relativeTo == null) |
||||
|
{ |
||||
|
throw new ArgumentNullException(nameof(relativeTo)); |
||||
|
} |
||||
|
|
||||
|
if (_target != null) |
||||
|
{ |
||||
|
point = _target.TranslatePoint(_targetLocation, relativeTo); |
||||
|
} |
||||
|
return point; |
||||
|
} |
||||
|
|
||||
|
public DragEventArgs(RoutedEvent<DragEventArgs> routedEvent, IDataObject data, Interactive target, Point targetLocation) |
||||
: base(routedEvent) |
: base(routedEvent) |
||||
{ |
{ |
||||
this.Data = data; |
this.Data = data; |
||||
|
this._target = target; |
||||
|
this._targetLocation = targetLocation; |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Interactive")] |
|
||||
@ -1,39 +1,11 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
<TargetFramework>netstandard2.0</TargetFramework> |
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Debug\Avalonia.Layout.xml</DocumentationFile> |
|
||||
<NoWarn>CS1591</NoWarn> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Release\Avalonia.Layout.xml</DocumentationFile> |
|
||||
<NoWarn>CS1591</NoWarn> |
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\Avalonia.Animation\Avalonia.Animation.csproj" /> |
<ProjectReference Include="..\Avalonia.Animation\Avalonia.Animation.csproj" /> |
||||
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
||||
<ProjectReference Include="..\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
<ProjectReference Include="..\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
<ItemGroup> |
|
||||
<Compile Include="..\Shared\SharedAssemblyInfo.cs"> |
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link> |
|
||||
</Compile> |
|
||||
</ItemGroup> |
|
||||
<Import Project="..\..\build\Rx.props" /> |
<Import Project="..\..\build\Rx.props" /> |
||||
</Project> |
</Project> |
||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Layout")] |
|
||||
@ -1,34 +1,10 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
<TargetFramework>netstandard2.0</TargetFramework> |
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Debug\Avalonia.Logging.Serilog.xml</DocumentationFile> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Release\Avalonia.Logging.Serilog.xml</DocumentationFile> |
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<Compile Include="..\Shared\SharedAssemblyInfo.cs" Link="Properties\SharedAssemblyInfo.cs" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
||||
<ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj" /> |
<ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
<Import Project="..\..\build\Serilog.props" /> |
<Import Project="..\..\build\Serilog.props" /> |
||||
</Project> |
</Project> |
||||
@ -1,3 +0,0 @@ |
|||||
using System.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Serilog")] |
|
||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.ReactiveUI")] |
|
||||
@ -1,6 +0,0 @@ |
|||||
// 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.Reflection; |
|
||||
|
|
||||
[assembly: AssemblyTitle("Avalonia.Themes.Default")] |
|
||||
@ -1,39 +1,11 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
<TargetFramework>netstandard2.0</TargetFramework> |
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> |
|
||||
<RootNamespace>Avalonia</RootNamespace> |
<RootNamespace>Avalonia</RootNamespace> |
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|
||||
<DebugSymbols>true</DebugSymbols> |
|
||||
<DebugType>full</DebugType> |
|
||||
<Optimize>false</Optimize> |
|
||||
<OutputPath>bin\Debug\</OutputPath> |
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Debug\Avalonia.Visuals.xml</DocumentationFile> |
|
||||
<NoWarn>CS1591</NoWarn> |
|
||||
</PropertyGroup> |
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|
||||
<DebugType>pdbonly</DebugType> |
|
||||
<Optimize>true</Optimize> |
|
||||
<OutputPath>bin\Release\</OutputPath> |
|
||||
<DefineConstants>TRACE</DefineConstants> |
|
||||
<ErrorReport>prompt</ErrorReport> |
|
||||
<WarningLevel>4</WarningLevel> |
|
||||
<DocumentationFile>bin\Release\Avalonia.Visuals.xml</DocumentationFile> |
|
||||
<NoWarn>CS1591</NoWarn> |
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\Avalonia.Animation\Avalonia.Animation.csproj" /> |
<ProjectReference Include="..\Avalonia.Animation\Avalonia.Animation.csproj" /> |
||||
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
<ItemGroup> |
|
||||
<Compile Include="..\Shared\SharedAssemblyInfo.cs"> |
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link> |
|
||||
</Compile> |
|
||||
</ItemGroup> |
|
||||
<Import Project="..\..\build\Rx.props" /> |
<Import Project="..\..\build\Rx.props" /> |
||||
</Project> |
</Project> |
||||
@ -0,0 +1,3 @@ |
|||||
|
<Project> |
||||
|
<Import Project="..\build\SharedVersion.props" /> |
||||
|
</Project> |
||||
@ -1,11 +1,237 @@ |
|||||
namespace Avalonia.Markup.Xaml |
// 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 Avalonia.Controls; |
||||
|
using Avalonia.Markup.Xaml.Data; |
||||
|
using Avalonia.Markup.Xaml.PortableXaml; |
||||
|
using Avalonia.Platform; |
||||
|
using Portable.Xaml; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Reflection; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Avalonia.Markup.Xaml |
||||
{ |
{ |
||||
public class AvaloniaXamlLoader : AvaloniaXamlLoaderPortableXaml |
/// <summary>
|
||||
|
/// Loads XAML for a avalonia application.
|
||||
|
/// </summary>
|
||||
|
public class AvaloniaXamlLoader |
||||
{ |
{ |
||||
public static object Parse(string xaml) |
private readonly AvaloniaXamlSchemaContext _context = GetContext(); |
||||
=> new AvaloniaXamlLoader().Load(xaml); |
|
||||
|
private static AvaloniaXamlSchemaContext GetContext() |
||||
|
{ |
||||
|
var result = AvaloniaLocator.Current.GetService<AvaloniaXamlSchemaContext>(); |
||||
|
|
||||
|
if (result == null) |
||||
|
{ |
||||
|
result = AvaloniaXamlSchemaContext.Create(); |
||||
|
|
||||
|
AvaloniaLocator.CurrentMutable |
||||
|
.Bind<AvaloniaXamlSchemaContext>() |
||||
|
.ToConstant(result); |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Initializes a new instance of the <see cref="AvaloniaXamlLoader"/> class.
|
||||
|
/// </summary>
|
||||
|
public AvaloniaXamlLoader() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Loads the XAML into a Avalonia component.
|
||||
|
/// </summary>
|
||||
|
/// <param name="obj">The object to load the XAML into.</param>
|
||||
|
public static void Load(object obj) |
||||
|
{ |
||||
|
Contract.Requires<ArgumentNullException>(obj != null); |
||||
|
|
||||
|
var loader = new AvaloniaXamlLoader(); |
||||
|
loader.Load(obj.GetType(), obj); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Loads the XAML for a type.
|
||||
|
/// </summary>
|
||||
|
/// <param name="type">The type.</param>
|
||||
|
/// <param name="rootInstance">
|
||||
|
/// The optional instance into which the XAML should be loaded.
|
||||
|
/// </param>
|
||||
|
/// <returns>The loaded object.</returns>
|
||||
|
public object Load(Type type, object rootInstance = null) |
||||
|
{ |
||||
|
Contract.Requires<ArgumentNullException>(type != null); |
||||
|
|
||||
|
// HACK: Currently Visual Studio is forcing us to change the extension of xaml files
|
||||
|
// in certain situations, so we try to load .xaml and if that's not found we try .xaml.
|
||||
|
// Ideally we'd be able to use .xaml everywhere
|
||||
|
var assetLocator = AvaloniaLocator.Current.GetService<IAssetLoader>(); |
||||
|
|
||||
|
if (assetLocator == null) |
||||
|
{ |
||||
|
throw new InvalidOperationException( |
||||
|
"Could not create IAssetLoader : maybe Application.RegisterServices() wasn't called?"); |
||||
|
} |
||||
|
|
||||
|
foreach (var uri in GetUrisFor(type)) |
||||
|
{ |
||||
|
if (assetLocator.Exists(uri)) |
||||
|
{ |
||||
|
using (var stream = assetLocator.Open(uri)) |
||||
|
{ |
||||
|
var initialize = rootInstance as ISupportInitialize; |
||||
|
initialize?.BeginInit(); |
||||
|
try |
||||
|
{ |
||||
|
return Load(stream, type.Assembly, rootInstance, uri); |
||||
|
} |
||||
|
finally |
||||
|
{ |
||||
|
initialize?.EndInit(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
throw new FileNotFoundException("Unable to find view for " + type.FullName); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Loads XAML from a URI.
|
||||
|
/// </summary>
|
||||
|
/// <param name="uri">The URI of the XAML file.</param>
|
||||
|
/// <param name="baseUri">
|
||||
|
/// A base URI to use if <paramref name="uri"/> is relative.
|
||||
|
/// </param>
|
||||
|
/// <param name="rootInstance">
|
||||
|
/// The optional instance into which the XAML should be loaded.
|
||||
|
/// </param>
|
||||
|
/// <returns>The loaded object.</returns>
|
||||
|
public object Load(Uri uri, Uri baseUri = null, object rootInstance = null) |
||||
|
{ |
||||
|
Contract.Requires<ArgumentNullException>(uri != null); |
||||
|
|
||||
|
var assetLocator = AvaloniaLocator.Current.GetService<IAssetLoader>(); |
||||
|
|
||||
|
if (assetLocator == null) |
||||
|
{ |
||||
|
throw new InvalidOperationException( |
||||
|
"Could not create IAssetLoader : maybe Application.RegisterServices() wasn't called?"); |
||||
|
} |
||||
|
|
||||
|
var asset = assetLocator.OpenAndGetAssembly(uri, baseUri); |
||||
|
using (var stream = asset.Item1) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
return Load(stream, asset.Item2, rootInstance, uri); |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
var uriString = uri.ToString(); |
||||
|
if (!uri.IsAbsoluteUri) |
||||
|
{ |
||||
|
uriString = new Uri(baseUri, uri).AbsoluteUri; |
||||
|
} |
||||
|
throw new XamlLoadException("Error loading xaml at " + uriString, e); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Loads XAML from a string.
|
||||
|
/// </summary>
|
||||
|
/// <param name="xaml">The string containing the XAML.</param>
|
||||
|
/// <param name="localAssembly">Default assembly for clr-namespace:</param>
|
||||
|
/// <param name="rootInstance">
|
||||
|
/// The optional instance into which the XAML should be loaded.
|
||||
|
/// </param>
|
||||
|
/// <returns>The loaded object.</returns>
|
||||
|
public object Load(string xaml, Assembly localAssembly = null, object rootInstance = null) |
||||
|
{ |
||||
|
Contract.Requires<ArgumentNullException>(xaml != null); |
||||
|
|
||||
|
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml))) |
||||
|
{ |
||||
|
return Load(stream, localAssembly, rootInstance); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Loads XAML from a stream.
|
||||
|
/// </summary>
|
||||
|
/// <param name="stream">The stream containing the XAML.</param>
|
||||
|
/// <param name="localAssembly">Default assembly for clr-namespace</param>
|
||||
|
/// <param name="rootInstance">
|
||||
|
/// The optional instance into which the XAML should be loaded.
|
||||
|
/// </param>
|
||||
|
/// <param name="uri">The URI of the XAML</param>
|
||||
|
/// <returns>The loaded object.</returns>
|
||||
|
public object Load(Stream stream, Assembly localAssembly, object rootInstance = null, Uri uri = null) |
||||
|
{ |
||||
|
var readerSettings = new XamlXmlReaderSettings() |
||||
|
{ |
||||
|
BaseUri = uri, |
||||
|
LocalAssembly = localAssembly |
||||
|
}; |
||||
|
|
||||
|
var reader = new XamlXmlReader(stream, _context, readerSettings); |
||||
|
|
||||
|
object result = LoadFromReader( |
||||
|
reader, |
||||
|
AvaloniaXamlContext.For(readerSettings, rootInstance)); |
||||
|
|
||||
|
var topLevel = result as TopLevel; |
||||
|
|
||||
|
if (topLevel != null) |
||||
|
{ |
||||
|
DelayedBinding.ApplyBindings(topLevel); |
||||
|
} |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
internal static object LoadFromReader(XamlReader reader, AvaloniaXamlContext context = null, IAmbientProvider parentAmbientProvider = null) |
||||
|
{ |
||||
|
var writer = AvaloniaXamlObjectWriter.Create( |
||||
|
reader.SchemaContext, |
||||
|
context, |
||||
|
parentAmbientProvider); |
||||
|
|
||||
|
XamlServices.Transform(reader, writer); |
||||
|
writer.ApplyAllDelayedProperties(); |
||||
|
return writer.Result; |
||||
|
} |
||||
|
|
||||
|
internal static object LoadFromReader(XamlReader reader) |
||||
|
{ |
||||
|
//return XamlServices.Load(reader);
|
||||
|
return LoadFromReader(reader, null); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets the URI for a type.
|
||||
|
/// </summary>
|
||||
|
/// <param name="type">The type.</param>
|
||||
|
/// <returns>The URI.</returns>
|
||||
|
private static IEnumerable<Uri> GetUrisFor(Type type) |
||||
|
{ |
||||
|
var asm = type.GetTypeInfo().Assembly.GetName().Name; |
||||
|
var typeName = type.FullName; |
||||
|
yield return new Uri("resm:" + typeName + ".xaml?assembly=" + asm); |
||||
|
yield return new Uri("resm:" + typeName + ".paml?assembly=" + asm); |
||||
|
} |
||||
|
|
||||
|
public static object Parse(string xaml, Assembly localAssembly = null) |
||||
|
=> new AvaloniaXamlLoader().Load(xaml, localAssembly); |
||||
|
|
||||
public static T Parse<T>(string xaml) |
public static T Parse<T>(string xaml, Assembly localAssembly = null) |
||||
=> (T)Parse(xaml); |
=> (T)Parse(xaml, localAssembly); |
||||
} |
} |
||||
} |
} |
||||
@ -1,227 +0,0 @@ |
|||||
// 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 Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml.Data; |
|
||||
using Avalonia.Markup.Xaml.PortableXaml; |
|
||||
using Avalonia.Platform; |
|
||||
using Portable.Xaml; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.IO; |
|
||||
using System.Reflection; |
|
||||
using System.Text; |
|
||||
|
|
||||
namespace Avalonia.Markup.Xaml |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Loads XAML for a avalonia application.
|
|
||||
/// </summary>
|
|
||||
public class AvaloniaXamlLoaderPortableXaml |
|
||||
{ |
|
||||
private readonly AvaloniaXamlSchemaContext _context = GetContext(); |
|
||||
|
|
||||
private static AvaloniaXamlSchemaContext GetContext() |
|
||||
{ |
|
||||
var result = AvaloniaLocator.Current.GetService<AvaloniaXamlSchemaContext>(); |
|
||||
|
|
||||
if (result == null) |
|
||||
{ |
|
||||
result = AvaloniaXamlSchemaContext.Create(); |
|
||||
|
|
||||
AvaloniaLocator.CurrentMutable |
|
||||
.Bind<AvaloniaXamlSchemaContext>() |
|
||||
.ToConstant(result); |
|
||||
} |
|
||||
|
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Initializes a new instance of the <see cref="AvaloniaXamlLoader"/> class.
|
|
||||
/// </summary>
|
|
||||
public AvaloniaXamlLoaderPortableXaml() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Loads the XAML into a Avalonia component.
|
|
||||
/// </summary>
|
|
||||
/// <param name="obj">The object to load the XAML into.</param>
|
|
||||
public static void Load(object obj) |
|
||||
{ |
|
||||
Contract.Requires<ArgumentNullException>(obj != null); |
|
||||
|
|
||||
var loader = new AvaloniaXamlLoader(); |
|
||||
loader.Load(obj.GetType(), obj); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Loads the XAML for a type.
|
|
||||
/// </summary>
|
|
||||
/// <param name="type">The type.</param>
|
|
||||
/// <param name="rootInstance">
|
|
||||
/// The optional instance into which the XAML should be loaded.
|
|
||||
/// </param>
|
|
||||
/// <returns>The loaded object.</returns>
|
|
||||
public object Load(Type type, object rootInstance = null) |
|
||||
{ |
|
||||
Contract.Requires<ArgumentNullException>(type != null); |
|
||||
|
|
||||
// HACK: Currently Visual Studio is forcing us to change the extension of xaml files
|
|
||||
// in certain situations, so we try to load .xaml and if that's not found we try .xaml.
|
|
||||
// Ideally we'd be able to use .xaml everywhere
|
|
||||
var assetLocator = AvaloniaLocator.Current.GetService<IAssetLoader>(); |
|
||||
|
|
||||
if (assetLocator == null) |
|
||||
{ |
|
||||
throw new InvalidOperationException( |
|
||||
"Could not create IAssetLoader : maybe Application.RegisterServices() wasn't called?"); |
|
||||
} |
|
||||
|
|
||||
foreach (var uri in GetUrisFor(type)) |
|
||||
{ |
|
||||
if (assetLocator.Exists(uri)) |
|
||||
{ |
|
||||
using (var stream = assetLocator.Open(uri)) |
|
||||
{ |
|
||||
var initialize = rootInstance as ISupportInitialize; |
|
||||
initialize?.BeginInit(); |
|
||||
try |
|
||||
{ |
|
||||
return Load(stream, rootInstance, uri); |
|
||||
} |
|
||||
finally |
|
||||
{ |
|
||||
initialize?.EndInit(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
throw new FileNotFoundException("Unable to find view for " + type.FullName); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Loads XAML from a URI.
|
|
||||
/// </summary>
|
|
||||
/// <param name="uri">The URI of the XAML file.</param>
|
|
||||
/// <param name="baseUri">
|
|
||||
/// A base URI to use if <paramref name="uri"/> is relative.
|
|
||||
/// </param>
|
|
||||
/// <param name="rootInstance">
|
|
||||
/// The optional instance into which the XAML should be loaded.
|
|
||||
/// </param>
|
|
||||
/// <returns>The loaded object.</returns>
|
|
||||
public object Load(Uri uri, Uri baseUri = null, object rootInstance = null) |
|
||||
{ |
|
||||
Contract.Requires<ArgumentNullException>(uri != null); |
|
||||
|
|
||||
var assetLocator = AvaloniaLocator.Current.GetService<IAssetLoader>(); |
|
||||
|
|
||||
if (assetLocator == null) |
|
||||
{ |
|
||||
throw new InvalidOperationException( |
|
||||
"Could not create IAssetLoader : maybe Application.RegisterServices() wasn't called?"); |
|
||||
} |
|
||||
|
|
||||
using (var stream = assetLocator.Open(uri, baseUri)) |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
return Load(stream, rootInstance, uri); |
|
||||
} |
|
||||
catch (Exception e) |
|
||||
{ |
|
||||
var uriString = uri.ToString(); |
|
||||
if (!uri.IsAbsoluteUri) |
|
||||
{ |
|
||||
uriString = new Uri(baseUri, uri).AbsoluteUri; |
|
||||
} |
|
||||
throw new XamlLoadException("Error loading xaml at " + uriString, e); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Loads XAML from a string.
|
|
||||
/// </summary>
|
|
||||
/// <param name="xaml">The string containing the XAML.</param>
|
|
||||
/// <param name="rootInstance">
|
|
||||
/// The optional instance into which the XAML should be loaded.
|
|
||||
/// </param>
|
|
||||
/// <returns>The loaded object.</returns>
|
|
||||
public object Load(string xaml, object rootInstance = null) |
|
||||
{ |
|
||||
Contract.Requires<ArgumentNullException>(xaml != null); |
|
||||
|
|
||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml))) |
|
||||
{ |
|
||||
return Load(stream, rootInstance); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Loads XAML from a stream.
|
|
||||
/// </summary>
|
|
||||
/// <param name="stream">The stream containing the XAML.</param>
|
|
||||
/// <param name="rootInstance">
|
|
||||
/// The optional instance into which the XAML should be loaded.
|
|
||||
/// </param>
|
|
||||
/// <param name="uri">The URI of the XAML</param>
|
|
||||
/// <returns>The loaded object.</returns>
|
|
||||
public object Load(Stream stream, object rootInstance = null, Uri uri = null) |
|
||||
{ |
|
||||
var readerSettings = new XamlXmlReaderSettings() |
|
||||
{ |
|
||||
BaseUri = uri, |
|
||||
LocalAssembly = rootInstance?.GetType().GetTypeInfo().Assembly |
|
||||
}; |
|
||||
|
|
||||
var reader = new XamlXmlReader(stream, _context, readerSettings); |
|
||||
|
|
||||
object result = LoadFromReader( |
|
||||
reader, |
|
||||
AvaloniaXamlContext.For(readerSettings, rootInstance)); |
|
||||
|
|
||||
var topLevel = result as TopLevel; |
|
||||
|
|
||||
if (topLevel != null) |
|
||||
{ |
|
||||
DelayedBinding.ApplyBindings(topLevel); |
|
||||
} |
|
||||
|
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
internal static object LoadFromReader(XamlReader reader, AvaloniaXamlContext context = null) |
|
||||
{ |
|
||||
var writer = AvaloniaXamlObjectWriter.Create( |
|
||||
reader.SchemaContext, |
|
||||
context); |
|
||||
|
|
||||
XamlServices.Transform(reader, writer); |
|
||||
writer.ApplyAllDelayedProperties(); |
|
||||
return writer.Result; |
|
||||
} |
|
||||
|
|
||||
internal static object LoadFromReader(XamlReader reader) |
|
||||
{ |
|
||||
//return XamlServices.Load(reader);
|
|
||||
return LoadFromReader(reader, null); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Gets the URI for a type.
|
|
||||
/// </summary>
|
|
||||
/// <param name="type">The type.</param>
|
|
||||
/// <returns>The URI.</returns>
|
|
||||
private static IEnumerable<Uri> GetUrisFor(Type type) |
|
||||
{ |
|
||||
var asm = type.GetTypeInfo().Assembly.GetName().Name; |
|
||||
var typeName = type.FullName; |
|
||||
yield return new Uri("resm:" + typeName + ".xaml?assembly=" + asm); |
|
||||
yield return new Uri("resm:" + typeName + ".paml?assembly=" + asm); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue