File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.Primitives/ConstrainedPresenter Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,20 @@ public AspectRatio(double ratio)
4949 Height = 1 ;
5050 }
5151
52+ /// <summary>
53+ /// Implicit conversion operator to convert an <see cref="AspectRatio"/> to a <see cref="double"/> value.
54+ /// This lets you use them easily in mathmatical expressions.
55+ /// </summary>
56+ /// <param name="aspect"><see cref="AspectRatio"/> instance.</param>
57+ public static implicit operator double ( AspectRatio aspect ) => aspect . Value ;
58+
59+ /// <summary>
60+ /// Implicit conversion operator to convert a <see cref="double"/> to an <see cref="AspectRatio"/> value.
61+ /// This allows for x:Bind to bind to a double value.
62+ /// </summary>
63+ /// <param name="ratio"><see cref="double"/> value representing the <see cref="AspectRatio"/>.</param>
64+ public static implicit operator AspectRatio ( double ratio ) => new AspectRatio ( ratio ) ;
65+
5266 /// <summary>
5367 /// Converter to take a string aspect ration like "16:9" and convert it to an <see cref="AspectRatio"/> struct.
5468 /// Used automatically by XAML.
You can’t perform that action at this time.
0 commit comments