147 changed files with 1749 additions and 833 deletions
@ -1,5 +1,3 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
<Settings /> |
|||
</ProjectConfiguration> |
|||
@ -1,5 +1,3 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
<Settings /> |
|||
</ProjectConfiguration> |
|||
@ -1,5 +1,3 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
<Settings /> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="Moq" Version="4.7.25" /> |
|||
<PackageReference Include="Moq" Version="4.7.99" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,20 @@ |
|||
using ReactiveUI; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Windows.Input; |
|||
|
|||
namespace BindingTest.ViewModels |
|||
{ |
|||
public class NestedCommandViewModel : ReactiveObject |
|||
{ |
|||
public NestedCommandViewModel() |
|||
{ |
|||
Command = ReactiveCommand.Create(); |
|||
} |
|||
|
|||
public ICommand Command { get; } |
|||
} |
|||
} |
|||
@ -1,22 +1,41 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui"> |
|||
<StackPanel Orientation="Vertical" Gap="4"> |
|||
<TextBlock Classes="h1">ToolTip</TextBlock> |
|||
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
|||
<StackPanel Orientation="Vertical" |
|||
Gap="4"> |
|||
<TextBlock Classes="h1">ToolTip</TextBlock> |
|||
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
|||
|
|||
<StackPanel Orientation="Horizontal" |
|||
<Grid RowDefinitions="Auto,Auto" |
|||
ColumnDefinitions="Auto,Auto" |
|||
Margin="0,16,0,0" |
|||
HorizontalAlignment="Center" |
|||
Gap="16"> |
|||
<Border Background="{StyleResource ThemeAccentBrush}" |
|||
Padding="48,48,48,48"> |
|||
<ToolTip.Tip> |
|||
<StackPanel> |
|||
<TextBlock Classes="h1">ToolTip</TextBlock> |
|||
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
|||
</StackPanel> |
|||
</ToolTip.Tip> |
|||
<TextBlock>Hover Here</TextBlock> |
|||
</Border> |
|||
HorizontalAlignment="Center"> |
|||
<Border Grid.Column="0" |
|||
Grid.Row="1" |
|||
Background="{StyleResource ThemeAccentBrush}" |
|||
Margin="5" |
|||
Padding="50" |
|||
ToolTip.Tip="This is a ToolTip"> |
|||
<TextBlock>Hover Here</TextBlock> |
|||
</Border> |
|||
<CheckBox Grid.Column="1" |
|||
Margin="5" |
|||
Grid.Row="0" |
|||
IsChecked="{Binding ElementName=Border, Path=(ToolTip.IsOpen)}" |
|||
Content="ToolTip Open" /> |
|||
<Border Name="Border" |
|||
Grid.Column="1" |
|||
Grid.Row="1" |
|||
Background="{StyleResource ThemeAccentBrush}" |
|||
Margin="5" |
|||
Padding="50" |
|||
ToolTip.Placement="Bottom"> |
|||
<ToolTip.Tip> |
|||
<StackPanel> |
|||
<TextBlock Classes="h1">ToolTip</TextBlock> |
|||
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
|||
</StackPanel> |
|||
</ToolTip.Tip> |
|||
<TextBlock>ToolTip bottom placement</TextBlock> |
|||
</Border> |
|||
</Grid> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,132 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|||
<UserControl.Styles> |
|||
<Style> |
|||
<Style.Resources> |
|||
<DrawingGroup x:Key="Bulb"> |
|||
<DrawingGroup.Transform> |
|||
<MatrixTransform Matrix="1,0,0,1,0,-1028.4" /> |
|||
</DrawingGroup.Transform> |
|||
<DrawingGroup> |
|||
<DrawingGroup.Transform> |
|||
<MatrixTransform Matrix="1,0,0,1.25,-10,1031.4" /> |
|||
</DrawingGroup.Transform> |
|||
<GeometryDrawing Brush="#FF7F8C8D" |
|||
Geometry="F1 M24,14 A2,2,0,1,1,20,14 A2,2,0,1,1,24,14 z" /> |
|||
</DrawingGroup> |
|||
<GeometryDrawing Brush="#FFF39C12" |
|||
Geometry="F1 M12,1030.4 C8.134,1030.4 5,1033.6 5,1037.6 5,1040.7 8.125,1043.5 9,1045.4 9.875,1047.2 9,1050.4 9,1050.4 L12,1049.9 15,1050.4 C15,1050.4 14.125,1047.2 15,1045.4 15.875,1043.5 19,1040.7 19,1037.6 19,1033.6 15.866,1030.4 12,1030.4 z" /> |
|||
<GeometryDrawing Brush="#FFF1C40F" |
|||
Geometry="F1 M12,1030.4 C15.866,1030.4 19,1033.6 19,1037.6 19,1040.7 15.875,1043.5 15,1045.4 14.125,1047.2 15,1050.4 15,1050.4 L12,1049.9 12,1030.4 z" /> |
|||
<GeometryDrawing Brush="#FFE67E22" |
|||
Geometry="F1 M9,1036.4 L8,1037.4 12,1049.4 16,1037.4 15,1036.4 14,1037.4 13,1036.4 12,1037.4 11,1036.4 10,1037.4 9,1036.4 z M9,1037.4 L10,1038.4 10.5,1037.9 11,1037.4 11.5,1037.9 12,1038.4 12.5,1037.9 13,1037.4 13.5,1037.9 14,1038.4 15,1037.4 15.438,1037.8 12,1048.1 8.5625,1037.8 9,1037.4 z" /> |
|||
<DrawingGroup> |
|||
<DrawingGroup.Transform> |
|||
<MatrixTransform Matrix="1,0,0,1,9,1045.4" /> |
|||
</DrawingGroup.Transform> |
|||
<GeometryDrawing Brush="#FFBDC3C7"> |
|||
<GeometryDrawing.Geometry> |
|||
<RectangleGeometry Rect="0,0,6,5" /> |
|||
</GeometryDrawing.Geometry> |
|||
</GeometryDrawing> |
|||
</DrawingGroup> |
|||
<GeometryDrawing Brush="#FF95A5A6" |
|||
Geometry="F1 M9,1045.4 L9,1050.4 12,1050.4 12,1049.4 15,1049.4 15,1048.4 12,1048.4 12,1047.4 15,1047.4 15,1046.4 12,1046.4 12,1045.4 9,1045.4 z" /> |
|||
<GeometryDrawing Brush="#FF7F8C8D" |
|||
Geometry="F1 M9,1046.4 L9,1047.4 12,1047.4 12,1046.4 9,1046.4 z M9,1048.4 L9,1049.4 12,1049.4 12,1048.4 9,1048.4 z" /> |
|||
</DrawingGroup> |
|||
</Style.Resources> |
|||
</Style> |
|||
</UserControl.Styles> |
|||
<Grid RowDefinitions="Auto,Auto,Auto" |
|||
ColumnDefinitions="Auto,Auto,Auto,Auto"> |
|||
<TextBlock Text="None" |
|||
Margin="3" /> |
|||
<Border Grid.Column="0" |
|||
Grid.Row="1" |
|||
VerticalAlignment="Top" |
|||
HorizontalAlignment="Left" |
|||
BorderThickness="1" |
|||
BorderBrush="Gray" |
|||
Margin="5"> |
|||
<DrawingPresenter Drawing="{StyleResource Bulb}" /> |
|||
</Border> |
|||
<TextBlock Text="Fill" |
|||
Margin="3" |
|||
Grid.Column="1" /> |
|||
<Border Grid.Column="1" |
|||
Grid.Row="1" |
|||
VerticalAlignment="Top" |
|||
HorizontalAlignment="Left" |
|||
BorderThickness="1" |
|||
BorderBrush="Gray" |
|||
Margin="5"> |
|||
<DrawingPresenter Drawing="{StyleResource Bulb}" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="Fill" /> |
|||
</Border> |
|||
<TextBlock Text="Uniform" |
|||
Margin="3" |
|||
Grid.Column="2" /> |
|||
<Border Grid.Column="2" |
|||
Grid.Row="1" |
|||
VerticalAlignment="Top" |
|||
HorizontalAlignment="Left" |
|||
BorderThickness="1" |
|||
BorderBrush="Gray" |
|||
Margin="5"> |
|||
<DrawingPresenter Drawing="{StyleResource Bulb}" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="Uniform" /> |
|||
</Border> |
|||
<TextBlock Text="UniformToFill" |
|||
Margin="3" |
|||
Grid.Column="3" /> |
|||
<Border Grid.Column="3" |
|||
Grid.Row="1" |
|||
VerticalAlignment="Top" |
|||
HorizontalAlignment="Left" |
|||
BorderThickness="1" |
|||
BorderBrush="Gray" |
|||
Margin="5"> |
|||
<DrawingPresenter Drawing="{StyleResource Bulb}" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="UniformToFill" /> |
|||
</Border> |
|||
|
|||
<!-- For comparison --> |
|||
|
|||
<Ellipse Grid.Row="2" |
|||
Grid.Column="0" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="None" |
|||
Fill="Blue" |
|||
Margin="5"/> |
|||
<Ellipse Grid.Row="2" |
|||
Grid.Column="1" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="Fill" |
|||
Fill="Blue" |
|||
Margin="5" /> |
|||
<Ellipse Grid.Row="2" |
|||
Grid.Column="2" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="Uniform" |
|||
Fill="Blue" |
|||
Margin="5" /> |
|||
<Ellipse Grid.Row="2" |
|||
Grid.Column="3" |
|||
Width="100" |
|||
Height="50" |
|||
Stretch="UniformToFill" |
|||
Fill="Blue" |
|||
Margin="5" /> |
|||
|
|||
</Grid> |
|||
</UserControl> |
|||
@ -0,0 +1,18 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace RenderTest.Pages |
|||
{ |
|||
public class DrawingPage : UserControl |
|||
{ |
|||
public DrawingPage() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using Avalonia.Data; |
|||
|
|||
namespace Avalonia.Logging |
|||
{ |
|||
internal static class LoggerExtensions |
|||
{ |
|||
public static void LogIfError( |
|||
this BindingNotification notification, |
|||
object source, |
|||
AvaloniaProperty property) |
|||
{ |
|||
if (notification.ErrorType == BindingErrorType.Error) |
|||
{ |
|||
if (notification.Error is AggregateException aggregate) |
|||
{ |
|||
foreach (var inner in aggregate.InnerExceptions) |
|||
{ |
|||
LogError(source, property, inner); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
LogError(source, property, notification.Error); |
|||
} |
|||
} |
|||
} |
|||
|
|||
private static void LogError(object source, AvaloniaProperty property, Exception e) |
|||
{ |
|||
var level = LogEventLevel.Warning; |
|||
|
|||
if (e is BindingChainException b && |
|||
!string.IsNullOrEmpty(b.Expression) && |
|||
string.IsNullOrEmpty(b.ExpressionErrorPoint)) |
|||
{ |
|||
// The error occurred at the root of the binding chain: it's possible that the
|
|||
// DataContext isn't set up yet, so log at Information level instead of Warning
|
|||
// to prevent spewing hundreds of errors.
|
|||
level = LogEventLevel.Information; |
|||
} |
|||
|
|||
Logger.Log( |
|||
level, |
|||
LogArea.Binding, |
|||
source, |
|||
"Error in binding to {Target}.{Property}: {Message}", |
|||
source, |
|||
property, |
|||
e.Message); |
|||
} |
|||
} |
|||
} |
|||
@ -1,23 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Avalonia.Utilities |
|||
{ |
|||
internal static class ExceptionUtilities |
|||
{ |
|||
public static string GetMessage(Exception e) |
|||
{ |
|||
var aggregate = e as AggregateException; |
|||
|
|||
if (aggregate != null) |
|||
{ |
|||
return string.Join(" | ", aggregate.InnerExceptions.Select(x => x.Message)); |
|||
} |
|||
|
|||
return e.Message; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
using Avalonia.Controls.Shapes; |
|||
using Avalonia.Media; |
|||
using Avalonia.Metadata; |
|||
|
|||
namespace Avalonia.Controls |
|||
{ |
|||
public class DrawingPresenter : Control |
|||
{ |
|||
static DrawingPresenter() |
|||
{ |
|||
AffectsMeasure(DrawingProperty); |
|||
AffectsRender(DrawingProperty); |
|||
} |
|||
|
|||
public static readonly StyledProperty<Drawing> DrawingProperty = |
|||
AvaloniaProperty.Register<DrawingPresenter, Drawing>(nameof(Drawing)); |
|||
|
|||
public static readonly StyledProperty<Stretch> StretchProperty = |
|||
AvaloniaProperty.Register<DrawingPresenter, Stretch>(nameof(Stretch), Stretch.Uniform); |
|||
|
|||
[Content] |
|||
public Drawing Drawing |
|||
{ |
|||
get => GetValue(DrawingProperty); |
|||
set => SetValue(DrawingProperty, value); |
|||
} |
|||
|
|||
public Stretch Stretch |
|||
{ |
|||
get => GetValue(StretchProperty); |
|||
set => SetValue(StretchProperty, value); |
|||
} |
|||
|
|||
private Matrix _transform = Matrix.Identity; |
|||
|
|||
protected override Size MeasureOverride(Size availableSize) |
|||
{ |
|||
if (Drawing == null) return new Size(); |
|||
|
|||
var (size, transform) = Shape.CalculateSizeAndTransform(availableSize, Drawing.GetBounds(), Stretch); |
|||
|
|||
_transform = transform; |
|||
|
|||
return size; |
|||
} |
|||
|
|||
public override void Render(DrawingContext context) |
|||
{ |
|||
if (Drawing != null) |
|||
{ |
|||
using (context.PushPreTransform(_transform)) |
|||
using (context.PushClip(Bounds)) |
|||
{ |
|||
Drawing.Draw(context); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
// 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; |
|||
|
|||
namespace Avalonia.Controls.Templates |
|||
{ |
|||
/// <summary>
|
|||
/// Defines an element that has a <see cref="DataTemplates"/> collection.
|
|||
/// </summary>
|
|||
public interface IDataTemplateHost |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the data templates for the element.
|
|||
/// </summary>
|
|||
DataTemplates DataTemplates { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets a value indicating whether <see cref="DataTemplates"/> is initialized.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// The <see cref="DataTemplates"/> property may be lazily initialized, if so this property
|
|||
/// indicates whether it has been initialized.
|
|||
/// </remarks>
|
|||
bool IsDataTemplatesInitialized { get; } |
|||
} |
|||
} |
|||
@ -0,0 +1,98 @@ |
|||
using System; |
|||
using Avalonia.Input; |
|||
using Avalonia.Threading; |
|||
|
|||
namespace Avalonia.Controls |
|||
{ |
|||
/// <summary>
|
|||
/// Handeles <see cref="ToolTip"/> interaction with controls.
|
|||
/// </summary>
|
|||
internal sealed class ToolTipService |
|||
{ |
|||
public static ToolTipService Instance { get; } = new ToolTipService(); |
|||
|
|||
private DispatcherTimer _timer; |
|||
|
|||
private ToolTipService() { } |
|||
|
|||
/// <summary>
|
|||
/// called when the <see cref="ToolTip.TipProperty"/> property changes on a control.
|
|||
/// </summary>
|
|||
/// <param name="e">The event args.</param>
|
|||
internal void TipChanged(AvaloniaPropertyChangedEventArgs e) |
|||
{ |
|||
var control = (Control)e.Sender; |
|||
|
|||
if (e.OldValue != null) |
|||
{ |
|||
control.PointerEnter -= ControlPointerEnter; |
|||
control.PointerLeave -= ControlPointerLeave; |
|||
} |
|||
|
|||
if (e.NewValue != null) |
|||
{ |
|||
control.PointerEnter += ControlPointerEnter; |
|||
control.PointerLeave += ControlPointerLeave; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Called when the pointer enters a control with an attached tooltip.
|
|||
/// </summary>
|
|||
/// <param name="sender">The event sender.</param>
|
|||
/// <param name="e">The event args.</param>
|
|||
private void ControlPointerEnter(object sender, PointerEventArgs e) |
|||
{ |
|||
StopTimer(); |
|||
|
|||
var control = (Control)sender; |
|||
var showDelay = ToolTip.GetShowDelay(control); |
|||
if (showDelay == 0) |
|||
{ |
|||
Open(control); |
|||
} |
|||
else |
|||
{ |
|||
StartShowTimer(showDelay, control); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Called when the pointer leaves a control with an attached tooltip.
|
|||
/// </summary>
|
|||
/// <param name="sender">The event sender.</param>
|
|||
/// <param name="e">The event args.</param>
|
|||
private void ControlPointerLeave(object sender, PointerEventArgs e) |
|||
{ |
|||
var control = (Control)sender; |
|||
Close(control); |
|||
} |
|||
|
|||
private void StartShowTimer(int showDelay, Control control) |
|||
{ |
|||
_timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(showDelay) }; |
|||
_timer.Tick += (o, e) => Open(control); |
|||
_timer.Start(); |
|||
} |
|||
|
|||
private void Open(Control control) |
|||
{ |
|||
StopTimer(); |
|||
|
|||
ToolTip.SetIsOpen(control, true); |
|||
} |
|||
|
|||
private void Close(Control control) |
|||
{ |
|||
StopTimer(); |
|||
|
|||
ToolTip.SetIsOpen(control, false); |
|||
} |
|||
|
|||
private void StopTimer() |
|||
{ |
|||
_timer?.Stop(); |
|||
_timer = null; |
|||
} |
|||
} |
|||
} |
|||
@ -1,72 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<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> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{4A1ABB09-9047-4BD5-A4AD-A055E52C5EE0}</ProjectGuid> |
|||
<OutputType>Library</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>Avalonia.DotNetFrameworkRuntime</RootNamespace> |
|||
<AssemblyName>Avalonia.DotNetFrameworkRuntime</AssemblyName> |
|||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<TargetFrameworkProfile /> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>TRACE;DEBUG;FULLDOTNET</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<DocumentationFile>bin\Debug\Avalonia.DotNetFrameworkRuntime.xml</DocumentationFile> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE;FULLDOTNET</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
<DocumentationFile>bin\Release\Avalonia.DotNetFrameworkRuntime.xml</DocumentationFile> |
|||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|||
</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="AppBuilder.cs" /> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
<Compile Include="RuntimeInfo.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj"> |
|||
<Project>{B09B78D8-9B26-48B0-9149-D64A2F120F3F}</Project> |
|||
<Name>Avalonia.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj"> |
|||
<Project>{D2221C82-4A25-4583-9B43-D791E3F6820C}</Project> |
|||
<Name>Avalonia.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\Avalonia.Visuals\Avalonia.Visuals.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Avalonia.Visuals</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\Avalonia.Styling\Avalonia.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Avalonia.Styling</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<Import Project="..\Shared\PlatformSupport\PlatformSupport.projitems" Label="Shared" /> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<Import Project="..\..\build\Rx.props" /> |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<TargetFramework>net461</TargetFramework> |
|||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> |
|||
<DocumentationFile>bin\$(Configuration)\Avalonia.DotNetFrameworkRuntime.xml</DocumentationFile> |
|||
<DefineConstants>$(DefineConstants);FULLDOTNET</DefineConstants> |
|||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Compile Include="..\Shared\SharedAssemblyInfo.cs"> |
|||
<Link>Properties\SharedAssemblyInfo.cs</Link> |
|||
</Compile> |
|||
|
|||
<ProjectReference Include="..\Avalonia.Base\Avalonia.Base.csproj" /> |
|||
<ProjectReference Include="..\Avalonia.Controls\Avalonia.Controls.csproj" /> |
|||
<ProjectReference Include="..\Avalonia.Visuals\Avalonia.Visuals.csproj" /> |
|||
<ProjectReference Include="..\Avalonia.Styling\Avalonia.Styling.csproj" /> |
|||
</ItemGroup> |
|||
<Import Project="..\Shared\PlatformSupport\PlatformSupport.projitems" Label="Shared" /> |
|||
<Import Project="..\..\build\Rx.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("Avalonia.DotNetFrameworkRuntime")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("Avalonia.DotNetFrameworkRuntime")] |
|||
[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("4a1abb09-9047-4bd5-a4ad-a055e52c5ee0")] |
|||
|
|||
// 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")] |
|||
@ -0,0 +1,9 @@ |
|||
namespace Avalonia.Media |
|||
{ |
|||
public abstract class Drawing : AvaloniaObject |
|||
{ |
|||
public abstract void Draw(DrawingContext context); |
|||
|
|||
public abstract Rect GetBounds(); |
|||
} |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
using Avalonia.Collections; |
|||
using Avalonia.Metadata; |
|||
|
|||
namespace Avalonia.Media |
|||
{ |
|||
public class DrawingGroup : Drawing |
|||
{ |
|||
public static readonly StyledProperty<double> OpacityProperty = |
|||
AvaloniaProperty.Register<DrawingGroup, double>(nameof(Opacity), 1); |
|||
|
|||
public static readonly StyledProperty<Transform> TransformProperty = |
|||
AvaloniaProperty.Register<DrawingGroup, Transform>(nameof(Transform)); |
|||
|
|||
public double Opacity |
|||
{ |
|||
get => GetValue(OpacityProperty); |
|||
set => SetValue(OpacityProperty, value); |
|||
} |
|||
|
|||
public Transform Transform |
|||
{ |
|||
get => GetValue(TransformProperty); |
|||
set => SetValue(TransformProperty, value); |
|||
} |
|||
|
|||
[Content] |
|||
public AvaloniaList<Drawing> Children { get; } = new AvaloniaList<Drawing>(); |
|||
|
|||
public override void Draw(DrawingContext context) |
|||
{ |
|||
using (context.PushPreTransform(Transform?.Value ?? Matrix.Identity)) |
|||
using (context.PushOpacity(Opacity)) |
|||
{ |
|||
foreach (var drawing in Children) |
|||
{ |
|||
drawing.Draw(context); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override Rect GetBounds() |
|||
{ |
|||
var rect = new Rect(); |
|||
|
|||
foreach (var drawing in Children) |
|||
{ |
|||
rect = rect.Union(drawing.GetBounds()); |
|||
} |
|||
|
|||
if (Transform != null) |
|||
{ |
|||
rect = rect.TransformToAABB(Transform.Value); |
|||
} |
|||
|
|||
return rect; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
namespace Avalonia.Media |
|||
{ |
|||
public class GeometryDrawing : Drawing |
|||
{ |
|||
public static readonly StyledProperty<Geometry> GeometryProperty = |
|||
AvaloniaProperty.Register<GeometryDrawing, Geometry>(nameof(Geometry)); |
|||
|
|||
public Geometry Geometry |
|||
{ |
|||
get => GetValue(GeometryProperty); |
|||
set => SetValue(GeometryProperty, value); |
|||
} |
|||
|
|||
public static readonly StyledProperty<IBrush> BrushProperty = |
|||
AvaloniaProperty.Register<GeometryDrawing, IBrush>(nameof(Brush), Brushes.Transparent); |
|||
|
|||
public IBrush Brush |
|||
{ |
|||
get => GetValue(BrushProperty); |
|||
set => SetValue(BrushProperty, value); |
|||
} |
|||
|
|||
public static readonly StyledProperty<Pen> PenProperty = |
|||
AvaloniaProperty.Register<GeometryDrawing, Pen>(nameof(Pen)); |
|||
|
|||
public Pen Pen |
|||
{ |
|||
get => GetValue(PenProperty); |
|||
set => SetValue(PenProperty, value); |
|||
} |
|||
|
|||
public override void Draw(DrawingContext context) |
|||
{ |
|||
context.DrawGeometry(Brush, Pen, Geometry); |
|||
} |
|||
|
|||
public override Rect GetBounds() |
|||
{ |
|||
// adding the Pen's stroke thickness here could yield wrong results due to transforms
|
|||
return Geometry?.GetRenderBounds(0) ?? new Rect(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Collections; |
|||
|
|||
namespace Avalonia |
|||
{ |
|||
public sealed class Points : AvaloniaList<Point> { } |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using System.Globalization; |
|||
|
|||
namespace Avalonia.Markup.Xaml.Converters |
|||
{ |
|||
using System.ComponentModel; |
|||
|
|||
public class MatrixTypeConverter : TypeConverter |
|||
{ |
|||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) |
|||
{ |
|||
return sourceType == typeof(string); |
|||
} |
|||
|
|||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) |
|||
{ |
|||
return Matrix.Parse((string)value, culture); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using System.Globalization; |
|||
|
|||
namespace Avalonia.Markup.Xaml.Converters |
|||
{ |
|||
using System.ComponentModel; |
|||
|
|||
public class RectTypeConverter : TypeConverter |
|||
{ |
|||
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) |
|||
{ |
|||
return sourceType == typeof(string); |
|||
} |
|||
|
|||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) |
|||
{ |
|||
return Rect.Parse((string)value, culture); |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue