mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Fix AspectRatioTrigger
This commit is contained in:
parent
becbbf81b6
commit
8559c576d6
1 changed files with 121 additions and 101 deletions
|
@ -30,7 +30,14 @@ namespace CalculatorApp.Views.StateTriggers
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty SourceProperty =
|
public static readonly DependencyProperty SourceProperty =
|
||||||
DependencyProperty.Register("Source", typeof(FrameworkElement), typeof(AspectRatioTrigger), new PropertyMetadata(null));
|
DependencyProperty.Register(
|
||||||
|
name: nameof(Source),
|
||||||
|
propertyType: typeof(FrameworkElement),
|
||||||
|
ownerType: typeof(AspectRatioTrigger),
|
||||||
|
typeMetadata: new PropertyMetadata(
|
||||||
|
defaultValue: null,
|
||||||
|
propertyChangedCallback: (s, e) => (s as AspectRatioTrigger)?.OnSourcePropertyChanged(e.OldValue as FrameworkElement, e.NewValue as FrameworkElement))
|
||||||
|
);
|
||||||
|
|
||||||
/* Either Height or Width. The property will determine which aspect is used as the numerator when calculating
|
/* Either Height or Width. The property will determine which aspect is used as the numerator when calculating
|
||||||
the aspect ratio. */
|
the aspect ratio. */
|
||||||
|
@ -42,7 +49,12 @@ namespace CalculatorApp.Views.StateTriggers
|
||||||
|
|
||||||
// Using a DependencyProperty as the backing store for NumeratorAspect. This enables animation, styling, binding, etc...
|
// Using a DependencyProperty as the backing store for NumeratorAspect. This enables animation, styling, binding, etc...
|
||||||
public static readonly DependencyProperty NumeratorAspectProperty =
|
public static readonly DependencyProperty NumeratorAspectProperty =
|
||||||
DependencyProperty.Register("NumeratorAspect", typeof(Aspect), typeof(AspectRatioTrigger), new PropertyMetadata(Aspect.Height));
|
DependencyProperty.Register(
|
||||||
|
name: "NumeratorAspect",
|
||||||
|
propertyType: typeof(Aspect),
|
||||||
|
ownerType: typeof(AspectRatioTrigger),
|
||||||
|
typeMetadata: new PropertyMetadata(Aspect.Height)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/* The threshold that will cause the trigger to fire when the aspect ratio exceeds this value. */
|
/* The threshold that will cause the trigger to fire when the aspect ratio exceeds this value. */
|
||||||
|
@ -54,9 +66,12 @@ namespace CalculatorApp.Views.StateTriggers
|
||||||
|
|
||||||
// Using a DependencyProperty as the backing store for Threshold. This enables animation, styling, binding, etc...
|
// Using a DependencyProperty as the backing store for Threshold. This enables animation, styling, binding, etc...
|
||||||
public static readonly DependencyProperty ThresholdProperty =
|
public static readonly DependencyProperty ThresholdProperty =
|
||||||
DependencyProperty.Register("Threshold", typeof(double), typeof(AspectRatioTrigger), new PropertyMetadata(0.0));
|
DependencyProperty.Register(
|
||||||
|
name: "Threshold",
|
||||||
|
propertyType: typeof(double),
|
||||||
|
ownerType: typeof(AspectRatioTrigger),
|
||||||
|
typeMetadata: new PropertyMetadata(0.0)
|
||||||
|
);
|
||||||
|
|
||||||
/* If true, the trigger will fire if the aspect ratio is greater than or equal to the threshold. */
|
/* If true, the trigger will fire if the aspect ratio is greater than or equal to the threshold. */
|
||||||
public bool ActiveIfEqual
|
public bool ActiveIfEqual
|
||||||
|
@ -67,7 +82,12 @@ namespace CalculatorApp.Views.StateTriggers
|
||||||
|
|
||||||
// Using a DependencyProperty as the backing store for ActiveIfEqual. This enables animation, styling, binding, etc...
|
// Using a DependencyProperty as the backing store for ActiveIfEqual. This enables animation, styling, binding, etc...
|
||||||
public static readonly DependencyProperty ActiveIfEqualProperty =
|
public static readonly DependencyProperty ActiveIfEqualProperty =
|
||||||
DependencyProperty.Register("ActiveIfEqual", typeof(bool), typeof(AspectRatioTrigger), new PropertyMetadata(false));
|
DependencyProperty.Register(
|
||||||
|
name: "ActiveIfEqual",
|
||||||
|
propertyType: typeof(bool),
|
||||||
|
ownerType: typeof(AspectRatioTrigger),
|
||||||
|
typeMetadata: new PropertyMetadata(false)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
AspectRatioTrigger()
|
AspectRatioTrigger()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue