diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.Primitives/ConstrainedPresenter/AspectRatio.cs b/Microsoft.Toolkit.Uwp.UI.Controls.Primitives/ConstrainedPresenter/AspectRatio.cs index 0e30671a631..f2d2cf559a0 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.Primitives/ConstrainedPresenter/AspectRatio.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.Primitives/ConstrainedPresenter/AspectRatio.cs @@ -49,6 +49,20 @@ public AspectRatio(double ratio) Height = 1; } + /// + /// Implicit conversion operator to convert an to a value. + /// This lets you use them easily in mathmatical expressions. + /// + /// instance. + public static implicit operator double(AspectRatio aspect) => aspect.Value; + + /// + /// Implicit conversion operator to convert a to an value. + /// This allows for x:Bind to bind to a double value. + /// + /// value representing the . + public static implicit operator AspectRatio(double ratio) => new AspectRatio(ratio); + /// /// Converter to take a string aspect ration like "16:9" and convert it to an struct. /// Used automatically by XAML.