Skip to content

Commit 194265d

Browse files
committed
Merged PR 20932: fix various issues
1 parent 4e1c447 commit 194265d

36 files changed

Lines changed: 179 additions & 67 deletions
7.91 KB
Loading
3.68 KB
Loading

windows.ui.composition/layervisual.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ A LayerVisual is a special input type that can be used to select a tree of visua
2828
| 1709 | 16299 | Shadow |
2929

3030
## -examples
31-
Apply Effects to a LayerVisual
31+
32+
This example shows how to apply a [GaussianBlurEffect](https://microsoft.github.io/Win2D/WinUI3/html/T_Microsoft_Graphics_Canvas_Effects_GaussianBlurEffect.htm) to a LayerVisual.
3233

3334
```csharp
3435

@@ -76,7 +77,13 @@ private async void InitComposition()
7677
}
7778

7879
```
79-
Add a [DropShadow](dropshadow.md)
80+
81+
The result looks like this.
82+
83+
:::image type="content" source="images/layer-visual-blur.png" alt-text="A red square overlapping a blue square with a blur effect applied.":::
84+
85+
This example shows how to apply a [DropShadow](dropshadow.md) to a LayerVisual.
86+
8087
```csharp
8188

8289
private async void InitComposition()
@@ -117,6 +124,9 @@ private async void InitComposition()
117124

118125
```
119126

127+
The result looks like this.
128+
129+
:::image type="content" source="images/layer-visual-shadow.png" alt-text="A red square overlapping a blue square with a shadow applied to each square.":::
120130

121131
## -see-also
122132
[ContainerVisual](containervisual.md), [IClosable](../windows.foundation/iclosable.md)

windows.ui.composition/layervisual_effect.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ public Windows.UI.Composition.CompositionEffectBrush Effect { get; set; }
1010
# Windows.UI.Composition.LayerVisual.Effect
1111

1212
## -description
13-
The effect to be applied to the flattened representation of the children of a [LayerVisual](layervisual.md).
14-
1513

14+
Gets or sets the effect to be applied to the flattened representation of the children of a [LayerVisual](layervisual.md).
1615

1716
## -property-value
17+
1818
The effect to be applied to the flattened representation of the children of a [LayerVisual](layervisual.md).
1919

2020
## -remarks
@@ -23,4 +23,57 @@ This CompositionEffectBrush cannot take a [CompositionBackdropBrush](composition
2323

2424
## -examples
2525

26+
This example shows how to apply a [GaussianBlurEffect](https://microsoft.github.io/Win2D/WinUI3/html/T_Microsoft_Graphics_Canvas_Effects_GaussianBlurEffect.htm) to a LayerVisual.
27+
28+
```csharp
29+
30+
private async void InitComposition()
31+
{
32+
Compositor compositor = ElementCompositionPreview.GetElementVisual(MyGrid).Compositor;
33+
34+
//Create LayerVisual
35+
LayerVisual layerVisual = compositor.CreateLayerVisual();
36+
layerVisual.Size = new Vector2(900,900);
37+
38+
//Create SpriteVisuals to use as LayerVisual child
39+
SpriteVisual sv1 = compositor.CreateSpriteVisual();
40+
sv1.Brush = compositor.CreateColorBrush(Windows.UI.Colors.Blue);
41+
sv1.Size = new Vector2(300, 300);
42+
sv1.Offset = new Vector3(200, 200, 0);
43+
44+
SpriteVisual sv2 = compositor.CreateSpriteVisual();
45+
sv2.Brush = compositor.CreateColorBrush(Colors.Red);
46+
sv2.Size = new Vector2(300, 300);
47+
sv2.Offset = new Vector3(400, 400, 0);
48+
49+
//Add children to the LayerVisual
50+
layerVisual.Children.InsertAtTop(sv1);
51+
layerVisual.Children.InsertAtTop(sv2);
52+
53+
//Create Effect
54+
var graphicsEffect = new GaussianBlurEffect
55+
{
56+
Name = "Blur",
57+
Source = new CompositionEffectSourceParameter("Backdrop"),
58+
BlurAmount = 10.0f,
59+
BorderMode = EffectBorderMode.Hard,
60+
Optimization = EffectOptimization.Balanced
61+
};
62+
63+
var blurEffectFactory = compositor.CreateEffectFactory(graphicsEffect,
64+
new[] { "Blur.BlurAmount" });
65+
var blurBrush = blurEffectFactory.CreateBrush();
66+
67+
//Apply Effect
68+
layerVisual.Effect = blurBrush;
69+
70+
ElementCompositionPreview.SetElementChildVisual(MyGrid, layerVisual);
71+
}
72+
73+
```
74+
75+
The result looks like this.
76+
77+
:::image type="content" source="images/layer-visual-blur.png" alt-text="A red square overlapping a blue square with a blur effect applied.":::
78+
2679
## -see-also

windows.ui.composition/layervisual_shadow.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,61 @@ public CompositionShadow Shadow { get; set; }
1010
# Windows.UI.Composition.LayerVisual.Shadow
1111

1212
## -description
13-
The shadow to be applied to the flattened representation of the children of a [LayerVisual](layervisual.md).
14-
1513

14+
Gets or sets the shadow to be applied to the flattened representation of the children of a [LayerVisual](layervisual.md).
1615

1716
## -property-value
1817

18+
The shadow to be applied to the flattened representation of the children of a [LayerVisual](layervisual.md).
19+
1920
## -remarks
2021

2122
## -see-also
2223

2324
## -examples
2425

26+
This example shows how to apply a [DropShadow](dropshadow.md) to a LayerVisual.
27+
28+
```csharp
29+
30+
private async void InitComposition()
31+
{
32+
Compositor compositor = ElementCompositionPreview.GetElementVisual(MyGrid).Compositor;
33+
34+
//Create LayerVisual
35+
LayerVisual layerVisual = compositor.CreateLayerVisual();
36+
layerVisual.Size = new Vector2(900, 900);
37+
38+
//Create SpriteVisuals to use as LayerVisual child
39+
SpriteVisual sv1 = compositor.CreateSpriteVisual();
40+
sv1.Brush = compositor.CreateColorBrush(Windows.UI.Colors.Blue);
41+
sv1.Size = new Vector2(300, 300);
42+
sv1.Offset = new Vector3(200, 200, 0);
43+
44+
SpriteVisual sv2 = compositor.CreateSpriteVisual();
45+
sv2.Brush = compositor.CreateColorBrush(Colors.Red);
46+
sv2.Size = new Vector2(300, 300);
47+
sv2.Offset = new Vector3(400, 400, 0);
48+
49+
//Add children to the LayerVisual
50+
layerVisual.Children.InsertAtTop(sv1);
51+
layerVisual.Children.InsertAtTop(sv2);
52+
53+
//Create DropShadow
54+
DropShadow shadow = compositor.CreateDropShadow();
55+
shadow.Color = Colors.DarkSlateGray;
56+
shadow.Offset = new Vector3(40, 40, 0);
57+
shadow.BlurRadius = 9;
58+
shadow.SourcePolicy = CompositionDropShadowSourcePolicy.InheritFromVisualContent;
59+
60+
//Associate Shadow with LayerVisual
61+
layerVisual.Shadow = shadow;
62+
63+
ElementCompositionPreview.SetElementChildVisual(MyGrid, layerVisual);
64+
}
65+
66+
```
67+
68+
The result looks like this.
69+
70+
:::image type="content" source="images/layer-visual-shadow.png" alt-text="A red square overlapping a blue square with a shadow applied to each square.":::

windows.ui.core/corewindow_bounds.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ public Windows.Foundation.Rect Bounds { get; }
1010
# Windows.UI.Core.CoreWindow.Bounds
1111

1212
## -description
13-
Gets the bounding rectangle of the window.
13+
14+
Gets a [Rect](../windows.foundation/rect.md) value that contains the origin, height, and width of the client area of the window, in device-independent pixels (DIPs).
1415

1516
## -property-value
16-
The bounding rectangle of the window, in device-independent pixels (DIPs).
17+
18+
A value that reports the origin, height, and width of the client area of the application window.
1719

1820
## -remarks
21+
22+
The origin of the `Rect` is relative to the system window that includes both the _client_ and _non-client_ areas.
23+
1924
To convert from DIPs to physical pixels (and back), use these equations (where DPI is the dots per inch value for the screen):
25+
2026
+ DIP value = (physical pixel x 96) / DPI
2127
+ physical pixel value = (DIP x DPI) / 96
2228

23-
2429
## -examples
2530

2631
## -see-also

windows.ui.xaml.controls/control_horizontalcontentalignment.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,31 @@ public Windows.UI.Xaml.HorizontalAlignment HorizontalContentAlignment { get; se
1010
# Windows.UI.Xaml.Controls.Control.HorizontalContentAlignment
1111

1212
## -description
13-
Gets or sets the horizontal alignment of the control's content.
14-
1513

14+
Gets or sets the horizontal alignment of the control's content.
1615

1716
## -xaml-syntax
17+
1818
```xaml
1919
<control HorizontalContentAlignment="horizontalAlignmentMemberName"/>
2020
```
2121

22-
2322
## -xaml-values
23+
2424
<dl><dt>horizontalAlignmentMemberName</dt><dd>horizontalAlignmentMemberNameA named constant of the HorizontalAlignment enumeration, such as Stretch.</dd>
2525
</dl>
26+
2627
## -property-value
27-
One of the [HorizontalAlignment](../windows.ui.xaml/horizontalalignment.md) values. The default is **Left**.
28+
One of the [HorizontalAlignment](../windows.ui.xaml/horizontalalignment.md) values. The default is `Center`.
2829

2930
## -remarks
30-
Each control might apply this property differently based on the [Style](../windows.ui.xaml/style.md) setters for the control's implicit style, and its visual template. Also, the apparent "default value" of each individual control used in UI can be different. For example, a [Button](button.md) control starts with the value **Center**.
3131

32-
A value for the HorizontalContentAlignment property only affects layout behavior for a control when its template uses the HorizontalContentAlignment property as the source of a [HorizontalAlignment](../windows.ui.xaml/frameworkelement_horizontalalignment.md) value for presenters or content areas within. On other controls, setting HorizontalContentAlignment has no effect. For more info about visual templates for controls, see the reference for [Control.Template](control_template.md).
33-
<!--link to TBW Styles and Templates overview-->
32+
Each control might apply this property differently based on the [Style](../windows.ui.xaml/style.md) setters for the control's implicit style, and its visual template. Also, the apparent "default value" of each individual control used in UI can be different.
33+
34+
A value for the HorizontalContentAlignment property only affects layout behavior for a control when its template uses the HorizontalContentAlignment property as the source of a [HorizontalAlignment](../windows.ui.xaml/frameworkelement_horizontalalignment.md) value for presenters or content areas within. On other controls, setting HorizontalContentAlignment has no effect. For more info about visual templates for controls, see the reference for [Control.Template](control_template.md) and [Control templates](/windows/apps/design/style/xaml-control-templates)
3435

3536
## -examples
3637

3738
## -see-also
38-
[VerticalContentAlignment](control_verticalcontentalignment.md), [FrameworkElement.HorizontalAlignment](../windows.ui.xaml/frameworkelement_horizontalalignment.md), [Alignment, margin, and padding](/windows/uwp/layout/alignment-margin-padding)
39+
40+
[VerticalContentAlignment](control_verticalcontentalignment.md), [FrameworkElement.HorizontalAlignment](../windows.ui.xaml/frameworkelement_horizontalalignment.md), [Alignment, margin, and padding](/windows/uwp/layout/alignment-margin-padding), [Control templates](/windows/apps/design/style/xaml-control-templates)

windows.ui.xaml.controls/control_verticalcontentalignment.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,32 @@ public Windows.UI.Xaml.VerticalAlignment VerticalContentAlignment { get; set; }
1010
# Windows.UI.Xaml.Controls.Control.VerticalContentAlignment
1111

1212
## -description
13-
Gets or sets the vertical alignment of the control's content.
14-
1513

14+
Gets or sets the vertical alignment of the control's content.
1615

1716
## -xaml-syntax
17+
1818
```xaml
1919
<control VerticalContentAlignment="verticalAlignmentValue"/>
2020
```
2121

22-
2322
## -xaml-values
23+
2424
<dl><dt>verticalAlignmentValue</dt><dd>verticalAlignmentValueA named constant of the VerticalAlignment enumeration, such as Stretch.</dd>
2525
</dl>
26+
2627
## -property-value
27-
One of the [VerticalAlignment](../windows.ui.xaml/verticalalignment.md) values. The default is **Top**.
28+
29+
One of the [VerticalAlignment](../windows.ui.xaml/verticalalignment.md) values. The default is `Center`.
2830

2931
## -remarks
30-
Each control might apply this property differently based on the [Style](../windows.ui.xaml/style.md) setters for the control's implicit style, and its visual template. Also, the apparent "default value" of each individual control used in UI can be different. For example, a [Button](button.md) control starts with the value **Center**.
3132

32-
A value for the VerticalContentAlignment property only affects layout behavior for a control when its template uses the VerticalContentAlignment property as the source of a [VerticalAlignment](../windows.ui.xaml/frameworkelement_verticalalignment.md) value for presenters or content areas within. On other controls, setting VerticalContentAlignment has no effect. For more info about visual templates for controls, see the reference for [Control.Template](control_template.md).
33-
<!--link to TBW Styles and Templates overview-->
33+
Each control might apply this property differently based on the [Style](../windows.ui.xaml/style.md) setters for the control's implicit style, and its visual template. Also, the apparent "default value" of each individual control used in UI can be different.
34+
35+
A value for the VerticalContentAlignment property only affects layout behavior for a control when its template uses the VerticalContentAlignment property as the source of a [VerticalAlignment](../windows.ui.xaml/frameworkelement_verticalalignment.md) value for presenters or content areas within. On other controls, setting VerticalContentAlignment has no effect. For more info about visual templates for controls, see the reference for [Control.Template](control_template.md) and [Control templates](/windows/apps/design/style/xaml-control-templates).
3436

3537
## -examples
3638

3739
## -see-also
38-
[HorizontalContentAlignment](control_horizontalcontentalignment.md), [FrameworkElement.VerticalAlignment](../windows.ui.xaml/frameworkelement_verticalalignment.md), [Alignment, margin, and padding](/windows/uwp/layout/alignment-margin-padding)
40+
41+
[HorizontalContentAlignment](control_horizontalcontentalignment.md), [FrameworkElement.VerticalAlignment](../windows.ui.xaml/frameworkelement_verticalalignment.md), [Alignment, margin, and padding](/windows/uwp/layout/alignment-margin-padding), [Control templates](/windows/apps/design/style/xaml-control-templates)

windows.ui.xaml.controls/datatemplateselector.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ See Remarks
2424

2525
For more info about data templates, see the [DataTemplate](../windows.ui.xaml/datatemplate.md) class and [Item containers and templates](/windows/uwp/design/controls-and-patterns/item-containers-templates).
2626

27-
The base DataTemplateSelector class is not used as an object element in XAML. However, it is a common scenario to derive a custom DataTemplateSelector, map a xmlns prefix for the custom class and its namespace/assembly, and then refer to an instance of the custom class as defined in a [Resources](../windows.ui.xaml/frameworkelement_resources.md) block in XAML. This makes it possible to refer to the custom template selector class by **x:Key**, and use that reference to set the value of properties such as [ItemTemplateSelector](itemscontrol_itemtemplateselector.md) in XAML templates and visual states.
27+
The base DataTemplateSelector class is not used as an object element in XAML. However, it is a common scenario to derive a custom DataTemplateSelector, map an `xmlns` prefix for the custom class and its namespace/assembly, and then refer to an instance of the custom class as defined in a [Resources](../windows.ui.xaml/frameworkelement_resources.md) block in XAML. This makes it possible to refer to the custom template selector class by `x:Key`, and use that reference to set the value of properties such as [ItemTemplateSelector](itemscontrol_itemtemplateselector.md) in XAML templates and visual states.
2828

2929
The callable methods of DataTemplateSelector are the two [SelectTemplate](datatemplateselector_selecttemplate_375443783.md) overloads. The overridable methods of DataTemplateSelector are the two [SelectTemplateCore](datatemplateselector_selecttemplatecore_402628248.md) overloads. To define an effective DataTemplateSelector subclass, provide implementations for [SelectTemplateCore(Object)](datatemplateselector_selecttemplatecore_402628248.md) and [SelectTemplateCore(Object, DependencyObject)](datatemplateselector_selecttemplatecore_711611086.md). All these methods return a [DataTemplate](../windows.ui.xaml/datatemplate.md) instance that's typically a specific choice that's appropriate for the inputs of the method that was called to obtain it.
3030

3131
App code typically doesn't call [SelectTemplate](datatemplateselector_selecttemplate_375443783.md) methods; the methods exists so that the infrastructure can call it while choosing the correct templates based on using a DataTemplateSelector instance from a property value such as [ItemsControl.ItemsTemplateSelector](itemscontrol_itemtemplateselector.md).
3232

33-
For example XAML that references a custom DataTemplateSelector as the [HeaderTemplateSelector](groupstyle_headertemplateselector.md) value, and example code that shows the overrides for [HeaderTemplateSelector](groupstyle_headertemplateselector.md) methods, see [How to group items in a list or grid](/previous-versions/windows/apps/hh780627(v=win.10)).
34-
3533
### Version history
3634

3735
| Windows version | SDK version | Value added |
@@ -42,4 +40,4 @@ For example XAML that references a custom DataTemplateSelector as the [HeaderTem
4240
## -examples
4341

4442
## -see-also
45-
[ItemTemplateSelector](itemscontrol_itemtemplateselector.md), [DataTemplate](../windows.ui.xaml/datatemplate.md), [ContentControl.ContentTemplateSelector](contentcontrol_contenttemplateselector.md), [GroupStyle.HeaderTemplateSelector](groupstyle_headertemplateselector.md), [How to group items in a list or grid](/previous-versions/windows/apps/hh780627(v=win.10)), [Adding ListView and GridView controls](/previous-versions/windows/apps/hh780618(v=win.10))
43+
[ItemTemplateSelector](itemscontrol_itemtemplateselector.md), [DataTemplate](../windows.ui.xaml/datatemplate.md), [ContentControl.ContentTemplateSelector](contentcontrol_contenttemplateselector.md), [GroupStyle.HeaderTemplateSelector](groupstyle_headertemplateselector.md)

windows.ui.xaml.controls/frame.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,5 @@ Private Sub OnNavigationFailed(sender As Object, e As NavigationFailedEventArgs)
244244
End Sub
245245
```
246246

247-
For a more detailed sample, see the [XAML Navigation sample](https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/XamlNavigation).
248-
249247
## -see-also
250248
[Page](page.md), [ContentControl](contentcontrol.md), [INavigate](inavigate.md)

0 commit comments

Comments
 (0)