|
14 | 14 | namespace Microsoft.Toolkit.Uwp.UI.Controls
|
15 | 15 | {
|
16 | 16 | /// <summary>
|
17 |
| - /// The <see cref="ConstrainedBox"/> is a <see cref="FrameworkElement"/> control akin to <see cref="Viewbox"/> |
18 |
| - /// which can modify the behavior of it's child element's layout. <see cref="ConstrainedBox"/> restricts the |
19 |
| - /// available size for its content based on a scale factor and/or a specific <see cref="AspectRatio"/>. |
20 |
| - /// This is performed as a layout calculation modification. |
| 17 | + /// Dependency properties for the <see cref="ConstrainedBox"/> class. |
21 | 18 | /// </summary>
|
22 |
| - /// <remarks> |
23 |
| - /// Note that this class being implemented as a <see cref="ContentPresenter"/> is an implementation detail, and |
24 |
| - /// is not meant to be used as one with a template. It is recommended to avoid styling the frame of the control |
25 |
| - /// with borders and not using <see cref="ContentPresenter.ContentTemplate"/> for future compatibility of your |
26 |
| - /// code if moving to WinUI 3 in the future. |
27 |
| - /// </remarks> |
28 | 19 | public partial class ConstrainedBox
|
29 | 20 | {
|
30 |
| - /// <summary> |
31 |
| - /// Gets or sets aspect Ratio to use for the contents of the Panel (after scaling). |
32 |
| - /// </summary> |
33 |
| - public AspectRatio AspectRatio |
34 |
| - { |
35 |
| - get { return (AspectRatio)GetValue(AspectRatioProperty); } |
36 |
| - set { SetValue(AspectRatioProperty, value); } |
37 |
| - } |
38 |
| - |
39 |
| - /// <summary> |
40 |
| - /// Identifies the <see cref="AspectRatio"/> property. |
41 |
| - /// </summary> |
42 |
| - public static readonly DependencyProperty AspectRatioProperty = |
43 |
| - DependencyProperty.Register(nameof(AspectRatio), typeof(AspectRatio), typeof(ConstrainedBox), new PropertyMetadata(null, ConstraintPropertyChanged)); |
44 |
| - |
45 | 21 | /// <summary>
|
46 | 22 | /// Gets or sets the scale for the width of the panel. Should be a value between 0-1.0. Default is 1.0.
|
47 | 23 | /// </summary>
|
@@ -72,6 +48,51 @@ public double ScaleY
|
72 | 48 | public static readonly DependencyProperty ScaleYProperty =
|
73 | 49 | DependencyProperty.Register(nameof(ScaleY), typeof(double), typeof(ConstrainedBox), new PropertyMetadata(1.0, ConstraintPropertyChanged));
|
74 | 50 |
|
| 51 | + /// <summary> |
| 52 | + /// Gets or sets the integer multiple that the width of the panel should be floored to. Default is null (no snap). |
| 53 | + /// </summary> |
| 54 | + public int MultipleX |
| 55 | + { |
| 56 | + get { return (int)GetValue(MultipleXProperty); } |
| 57 | + set { SetValue(MultipleXProperty, value); } |
| 58 | + } |
| 59 | + |
| 60 | + /// <summary> |
| 61 | + /// Identifies the <see cref="MultipleX"/> property. |
| 62 | + /// </summary> |
| 63 | + public static readonly DependencyProperty MultipleXProperty = |
| 64 | + DependencyProperty.Register(nameof(MultipleX), typeof(int), typeof(ConstrainedBox), new PropertyMetadata(null)); |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// Gets or sets the integer multiple that the height of the panel should be floored to. Default is null (no snap). |
| 68 | + /// </summary> |
| 69 | + public int MultipleY |
| 70 | + { |
| 71 | + get { return (int)GetValue(MultipleYProperty); } |
| 72 | + set { SetValue(MultipleYProperty, value); } |
| 73 | + } |
| 74 | + |
| 75 | + /// <summary> |
| 76 | + /// Identifies the <see cref="MultipleY"/> property. |
| 77 | + /// </summary> |
| 78 | + public static readonly DependencyProperty MultipleYProperty = |
| 79 | + DependencyProperty.Register(nameof(MultipleY), typeof(int), typeof(ConstrainedBox), new PropertyMetadata(null)); |
| 80 | + |
| 81 | + /// <summary> |
| 82 | + /// Gets or sets aspect Ratio to use for the contents of the Panel (after scaling). |
| 83 | + /// </summary> |
| 84 | + public AspectRatio AspectRatio |
| 85 | + { |
| 86 | + get { return (AspectRatio)GetValue(AspectRatioProperty); } |
| 87 | + set { SetValue(AspectRatioProperty, value); } |
| 88 | + } |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// Identifies the <see cref="AspectRatio"/> property. |
| 92 | + /// </summary> |
| 93 | + public static readonly DependencyProperty AspectRatioProperty = |
| 94 | + DependencyProperty.Register(nameof(AspectRatio), typeof(AspectRatio), typeof(ConstrainedBox), new PropertyMetadata(null, ConstraintPropertyChanged)); |
| 95 | + |
75 | 96 | private static void ConstraintPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
76 | 97 | {
|
77 | 98 | if (d is ConstrainedBox panel)
|
|
0 commit comments