fix:Go to AspectRatioLayout demo and go to another and go back, the demo will crash.
This commit is contained in:
@@ -11,7 +11,7 @@ public class AspectRatioLayout : TransitioningContentControl
|
|||||||
{
|
{
|
||||||
public static readonly StyledProperty<List<AspectRatioLayoutItem>> ItemsProperty =
|
public static readonly StyledProperty<List<AspectRatioLayoutItem>> ItemsProperty =
|
||||||
AvaloniaProperty.Register<AspectRatioLayout, List<AspectRatioLayoutItem>>(
|
AvaloniaProperty.Register<AspectRatioLayout, List<AspectRatioLayoutItem>>(
|
||||||
nameof(Items), new List<AspectRatioLayoutItem>());
|
nameof(Items));
|
||||||
|
|
||||||
public static readonly StyledProperty<double> AspectRatioChangeAmbiguityProperty =
|
public static readonly StyledProperty<double> AspectRatioChangeAmbiguityProperty =
|
||||||
AvaloniaProperty.Register<AspectRatioLayout, double>(
|
AvaloniaProperty.Register<AspectRatioLayout, double>(
|
||||||
@@ -21,12 +21,6 @@ public class AspectRatioLayout : TransitioningContentControl
|
|||||||
AvaloniaProperty.Register<AspectRatioLayout, AspectRatioMode>(
|
AvaloniaProperty.Register<AspectRatioLayout, AspectRatioMode>(
|
||||||
nameof(CurrentAspectRatioMode));
|
nameof(CurrentAspectRatioMode));
|
||||||
|
|
||||||
public AspectRatioMode CurrentAspectRatioMode
|
|
||||||
{
|
|
||||||
get => GetValue(CurrentAspectRatioModeProperty);
|
|
||||||
set => SetValue(CurrentAspectRatioModeProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Queue<bool> _history = new();
|
private readonly Queue<bool> _history = new();
|
||||||
|
|
||||||
static AspectRatioLayout()
|
static AspectRatioLayout()
|
||||||
@@ -40,6 +34,17 @@ public class AspectRatioLayout : TransitioningContentControl
|
|||||||
PageTransitionProperty.OverrideDefaultValue<AspectRatioLayout>(pCrossFade);
|
PageTransitionProperty.OverrideDefaultValue<AspectRatioLayout>(pCrossFade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AspectRatioLayout()
|
||||||
|
{
|
||||||
|
Items = new List<AspectRatioLayoutItem>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AspectRatioMode CurrentAspectRatioMode
|
||||||
|
{
|
||||||
|
get => GetValue(CurrentAspectRatioModeProperty);
|
||||||
|
set => SetValue(CurrentAspectRatioModeProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
protected override Type StyleKeyOverride => typeof(TransitioningContentControl);
|
protected override Type StyleKeyOverride => typeof(TransitioningContentControl);
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
|
|||||||
Reference in New Issue
Block a user