|
|
@ -6,9 +6,18 @@ namespace Avalonia.Controls |
|
|
{ |
|
|
{ |
|
|
public class DrawingPresenter : Control |
|
|
public class DrawingPresenter : Control |
|
|
{ |
|
|
{ |
|
|
|
|
|
static DrawingPresenter() |
|
|
|
|
|
{ |
|
|
|
|
|
AffectsMeasure(DrawingProperty); |
|
|
|
|
|
AffectsRender(DrawingProperty); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static readonly StyledProperty<Drawing> DrawingProperty = |
|
|
public static readonly StyledProperty<Drawing> DrawingProperty = |
|
|
AvaloniaProperty.Register<DrawingPresenter, Drawing>(nameof(Drawing)); |
|
|
AvaloniaProperty.Register<DrawingPresenter, Drawing>(nameof(Drawing)); |
|
|
|
|
|
|
|
|
|
|
|
public static readonly StyledProperty<Stretch> StretchProperty = |
|
|
|
|
|
AvaloniaProperty.Register<DrawingPresenter, Stretch>(nameof(Stretch), Stretch.Uniform); |
|
|
|
|
|
|
|
|
[Content] |
|
|
[Content] |
|
|
public Drawing Drawing |
|
|
public Drawing Drawing |
|
|
{ |
|
|
{ |
|
|
@ -16,21 +25,12 @@ namespace Avalonia.Controls |
|
|
set => SetValue(DrawingProperty, value); |
|
|
set => SetValue(DrawingProperty, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static readonly StyledProperty<Stretch> StretchProperty = |
|
|
|
|
|
AvaloniaProperty.Register<DrawingPresenter, Stretch>(nameof(Stretch), Stretch.Uniform); |
|
|
|
|
|
|
|
|
|
|
|
public Stretch Stretch |
|
|
public Stretch Stretch |
|
|
{ |
|
|
{ |
|
|
get => GetValue(StretchProperty); |
|
|
get => GetValue(StretchProperty); |
|
|
set => SetValue(StretchProperty, value); |
|
|
set => SetValue(StretchProperty, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static DrawingPresenter() |
|
|
|
|
|
{ |
|
|
|
|
|
AffectsMeasure(DrawingProperty); |
|
|
|
|
|
AffectsRender(DrawingProperty); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Matrix _transform = Matrix.Identity; |
|
|
private Matrix _transform = Matrix.Identity; |
|
|
|
|
|
|
|
|
protected override Size MeasureOverride(Size availableSize) |
|
|
protected override Size MeasureOverride(Size availableSize) |
|
|
|