diff --git a/hub/apps/design/layout/attached-layouts.md b/hub/apps/design/layout/attached-layouts.md index ec27d0d391..adbec8541e 100644 --- a/hub/apps/design/layout/attached-layouts.md +++ b/hub/apps/design/layout/attached-layouts.md @@ -81,7 +81,7 @@ With an attached layout, a single instance of the layout object may be associate - + @@ -240,7 +240,7 @@ Scrolling on Windows happens asynchronous to the UI thread. It is not controlled ![Realization rect](images/xaml-attached-layout-realizationrect.png) -Since element creation is costly, virtualizing containers (for example, [ItemsRepeater](../controls/items-repeater.md)) will initially provide the attached layout with a [RealizationRect](/uwp/api/microsoft.ui.xaml.controls.virtualizinglayoutcontext.realizationrect) that matches the viewport. On idle time the container may grow the buffer of prepared content by making repeated calls to the layout using an increasingly larger realization rect. This behavior is a performance optimization that attempts to strike a balance between fast startup time and a good panning experience. The maximum buffer size that the ItemsRepeater will generate is controlled by its [VerticalCacheLength](/uwp/api/microsoft.ui.xaml.controls.itemsrepeater.verticalcachelength) and [HorizontalCacheLength](/uwp/api/microsoft.ui.xaml.controls.itemsrepeater.verticalcachelength) properties. +Since element creation is costly, virtualizing containers (for example, [ItemsRepeater](../controls/items-repeater.md)) will initially provide the attached layout with a [RealizationRect](/uwp/api/microsoft.ui.xaml.controls.virtualizinglayoutcontext.realizationrect) that matches the viewport. On idle time the container may grow the buffer of prepared content by making repeated calls to the layout using an increasingly larger realization rect. This behavior is a performance optimization that attempts to strike a balance between fast startup time and a good panning experience. The maximum buffer size that the ItemsRepeater will generate is controlled by its [VerticalCacheLength](/uwp/api/microsoft.ui.xaml.controls.itemsrepeater.verticalcachelength) and [HorizontalCacheLength](/uwp/api/microsoft.ui.xaml.controls.itemsrepeater.horizontalcachelength) properties. **Re-using Elements (Recycling)** diff --git a/hub/apps/design/layout/boxpanel-example-custom-panel.md b/hub/apps/design/layout/boxpanel-example-custom-panel.md index 9283395139..8951b0ff54 100644 --- a/hub/apps/design/layout/boxpanel-example-custom-panel.md +++ b/hub/apps/design/layout/boxpanel-example-custom-panel.md @@ -137,7 +137,7 @@ Size LimitUnboundedSize(Size input) { if (Double.IsInfinity(input.Height)) { - input.Height = maxcellheight * colcount; + input.Height = maxcellheight * rowcount; cellheight = maxcellheight; } return input; diff --git a/hub/apps/desktop/modernize/ui/apply-windows-themes.md b/hub/apps/desktop/modernize/ui/apply-windows-themes.md index ae877c2cce..101c180d6e 100644 --- a/hub/apps/desktop/modernize/ui/apply-windows-themes.md +++ b/hub/apps/desktop/modernize/ui/apply-windows-themes.md @@ -229,7 +229,7 @@ HRESULT DwmSetWindowAttribute( ); ``` -After passing `hWnd` (the handle to the window you want to change) as your first parameter, you need to pass in `DWMWA_USE_IMMERSIVE_DARK_MODE` as the `dwAttribute` parameter. This is a constant in the DWM API that lets the Windows frame be drawn in Dark mode colors when the Dark mode system setting is enabled. If you switch to Light mode, you will have to change `DWMWA_USE_IMMERSIVE_DARK_MODE` from 20 to 0 for the title bar to be drawn in light mode colors. +After passing `hWnd` (the handle to the window you want to change) as your first parameter, you need to pass in `DWMWA_USE_IMMERSIVE_DARK_MODE` as the `dwAttribute` parameter. This is a constant in the DWM API that lets the Windows frame be drawn in Dark mode colors when the Dark mode system setting is enabled. If you switch to Light mode, keep `DWMWA_USE_IMMERSIVE_DARK_MODE` unchanged and set the `BOOL` passed through `pvAttribute` to `FALSE` for the title bar to be drawn in light mode colors. The `pvAttribute` parameter points to a value of type `BOOL` (which is why you made the `BOOL` value earlier). You need `pvAttribute` to be `TRUE` to honor Dark mode for the window. If `pvAttribute` is `FALSE`, the window will use Light Mode. diff --git a/hub/apps/develop/communication/copy-and-paste.md b/hub/apps/develop/communication/copy-and-paste.md index 1416269db5..0ca85c73f7 100644 --- a/hub/apps/develop/communication/copy-and-paste.md +++ b/hub/apps/develop/communication/copy-and-paste.md @@ -155,7 +155,7 @@ Clipboard.ContentChanged += async (s, e) => // To output the text from this example, you need a TextBlock control TextOutput.Text = "Clipboard now contains: " + text; } -} +}; ``` ### [C++/WinRT](#tab/cppwinrt) diff --git a/hub/apps/develop/platform/xaml/3-d-perspective-effects.md b/hub/apps/develop/platform/xaml/3-d-perspective-effects.md index 213d2c6bfa..28964b7c56 100644 --- a/hub/apps/develop/platform/xaml/3-d-perspective-effects.md +++ b/hub/apps/develop/platform/xaml/3-d-perspective-effects.md @@ -124,7 +124,7 @@ Notice how the image rotates around the center when the [**CenterOfRotationY**]( ```xml - + ``` diff --git a/hub/apps/develop/platform/xaml/transforms.md b/hub/apps/develop/platform/xaml/transforms.md index 2689124795..61935b4b65 100644 --- a/hub/apps/develop/platform/xaml/transforms.md +++ b/hub/apps/develop/platform/xaml/transforms.md @@ -20,7 +20,7 @@ Think of transforms in four broad classifications: translation, rotation, scalin - [**TranslateTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.TranslateTransform): translates an element in x-y space, by setting values for [**X**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.translatetransform.x) and [**Y**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.translatetransform.y). - [**ScaleTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.ScaleTransform): scales the transform based on a center point, by setting values for [**CenterX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.scaletransform.centerx), [**CenterY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.scaletransform.centery), [**ScaleX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.scaletransform.scalex) and [**ScaleY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.scaletransform.scaleyproperty). - [**RotateTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.RotateTransform): rotates in x-y space, by setting values for [**Angle**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.rotatetransform.angle), [**CenterX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.rotatetransform.centerx) and [**CenterY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.rotatetransform.centery). -- [**SkewTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.SkewTransform): skews or shears in x-y space, by setting values for [**AngleX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.anglex), [**AngleY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.angley), [**CenterX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.centerx) and [**CenterY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.scaletransform.centeryproperty). +- [**SkewTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.SkewTransform): skews or shears in x-y space, by setting values for [**AngleX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.anglex), [**AngleY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.angley), [**CenterX**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.centerx) and [**CenterY**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.skewtransform.centery). Of these, you're likely to use [**TranslateTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.TranslateTransform) and [**ScaleTransform**](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.Media.ScaleTransform) most often for UI scenarios. diff --git a/hub/apps/windows-app-sdk/applifecycle/applifecycle-instancing.md b/hub/apps/windows-app-sdk/applifecycle/applifecycle-instancing.md index 933d681f91..24cd140c86 100644 --- a/hub/apps/windows-app-sdk/applifecycle/applifecycle-instancing.md +++ b/hub/apps/windows-app-sdk/applifecycle/applifecycle-instancing.md @@ -45,7 +45,7 @@ Instancing behavior in the Windows App SDK is based on UWP's model, class, but w ### AppInstance class - **UWP**: The [Windows.ApplicationModel.AppInstance](/uwp/api/windows.applicationmodel.appinstance) class is focused purely on instance redirection scenarios. -- **Windows App SDK**: The [Microsoft.Windows.AppLifeycle.AppInstance](/windows/windows-app-sdk/api/winrt/microsoft.windows.applifecycle.appinstance) class supports instance redirection scenarios, and contains additional functionality to support new features in later releases. +- **Windows App SDK**: The [Microsoft.Windows.AppLifecycle.AppInstance](/windows/windows-app-sdk/api/winrt/microsoft.windows.applifecycle.appinstance) class supports instance redirection scenarios, and contains additional functionality to support new features in later releases. ### List of instances @@ -255,7 +255,7 @@ int APIENTRY wWinMain( AppInstance::GetCurrent().GetActivatedEventArgs(); // Check for any specific activation kind we care about. - ExtendedActivationKind kind = activationArgs.Kind; + ExtendedActivationKind kind = activationArgs.Kind(); if (kind == ExtendedActivationKind::File) { // etc... as in previous scenario. @@ -276,7 +276,7 @@ int APIENTRY wWinMain( bool isFound = false; for (AppInstance instance : instances) { - if (instance.Key == L"REUSABLE") + if (instance.Key() == L"REUSABLE") { isFound = true; instance.RedirectActivationToAsync(activationArgs).get(); @@ -303,7 +303,7 @@ This example again adds more sophisticated redirection behavior. Here, an app in ```cpp void OnActivated(const IInspectable&, const AppActivationArguments& args) { - const ExtendedActivationKind kind = args.Kind; + const ExtendedActivationKind kind = args.Kind(); // For example, we might want to redirect protocol activations. if (kind == ExtendedActivationKind::Protocol) @@ -314,7 +314,7 @@ void OnActivated(const IInspectable&, const AppActivationArguments& args) // We'll try to find the instance that handles protocol activations. // If there isn't one, then this instance will take over that duty. auto instance = AppInstance::FindOrRegisterForKey(uri.AbsoluteUri()); - if (!instance.IsCurrent) + if (!instance.IsCurrent()) { instance.RedirectActivationToAsync(args).get(); } @@ -405,7 +405,7 @@ void CALLBACK OnFileClosed(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ### Instance information -The [Microsoft.Windows.AppLifeycle.AppInstance](/windows/windows-app-sdk/api/winrt/microsoft.windows.applifecycle.appinstance) class represents a single instance of an app. In the current preview, `AppInstance` only includes the methods and properties necessary to support activation redirection. In later releases, `AppInstance` will expand to include other methods and properties relevant to an app instance. +The [Microsoft.Windows.AppLifecycle.AppInstance](/windows/windows-app-sdk/api/winrt/microsoft.windows.applifecycle.appinstance) class represents a single instance of an app. In the current preview, `AppInstance` only includes the methods and properties necessary to support activation redirection. In later releases, `AppInstance` will expand to include other methods and properties relevant to an app instance. ```cpp void DumpExistingInstances() @@ -424,4 +424,4 @@ void DumpExistingInstances() [Create a single-instanced WinUI app](applifecycle-single-instance.md) -[Microsoft.Windows.AppLifeycle.AppInstance](/windows/windows-app-sdk/api/winrt/microsoft.windows.applifecycle.appinstance) +[Microsoft.Windows.AppLifecycle.AppInstance](/windows/windows-app-sdk/api/winrt/microsoft.windows.applifecycle.appinstance) diff --git a/hub/apps/windows-app-sdk/applifecycle/applifecycle-power.md b/hub/apps/windows-app-sdk/applifecycle/applifecycle-power.md index 24b5073cd0..5787b1991b 100644 --- a/hub/apps/windows-app-sdk/applifecycle/applifecycle-power.md +++ b/hub/apps/windows-app-sdk/applifecycle/applifecycle-power.md @@ -191,10 +191,10 @@ void DetermineWorkloads() ```csharp private void DetermineWorkloads() { - BatteryStatus batteryStatus = PowerManager.BatteryStatus(); - int remainingCharge = PowerManager.RemainingChargePercent(); - PowerSupplyStatus powerStatus = PowerManager.PowerSupplyStatus(); - PowerSourceKind powerSource = PowerManager.PowerSourceKind(); + BatteryStatus batteryStatus = PowerManager.BatteryStatus; + int remainingCharge = PowerManager.RemainingChargePercent; + PowerSupplyStatus powerStatus = PowerManager.PowerSupplyStatus; + PowerSourceKind powerSource = PowerManager.PowerSourceKind; if ((powerSource == PowerSourceKind.DC && batteryStatus == BatteryStatus.Discharging diff --git a/hub/apps/windows-app-sdk/applifecycle/background-tasks.md b/hub/apps/windows-app-sdk/applifecycle/background-tasks.md index 5aaadc4db4..85a380516b 100644 --- a/hub/apps/windows-app-sdk/applifecycle/background-tasks.md +++ b/hub/apps/windows-app-sdk/applifecycle/background-tasks.md @@ -57,7 +57,7 @@ catch (...) } ``` -The following example shows how to register a background task using C#. In the Windows App SDK github sample, you can see this registration code in [MainWindow.Xaml.cpp](https://github.com/microsoft/WindowsAppSDK-Samples/blob/main/Samples/BackgroundTask/InProc%20BackgroundTask/cs-winui/BackgroundTaskBuilder/MainWindow.xaml.cs#L79). +The following example shows how to register a background task using C#. In the Windows App SDK github sample, you can see this registration code in [MainWindow.xaml.cs](https://github.com/microsoft/WindowsAppSDK-Samples/blob/main/Samples/BackgroundTask/InProc%20BackgroundTask/cs-winui/BackgroundTaskBuilder/MainWindow.xaml.cs#L79). ```csharp await BackgroundExecutionManager.RequestAccessAsync(); @@ -138,7 +138,7 @@ void BackgroundTask::OnCanceled(_In_ IBackgroundTaskInstance /* taskInstance */, } ``` -The following example shows how to implement **IBackgroundTask** using C#. In the Windows App SDK github sample, you can see this registration code in [BackgroundTask.cpp](https://github.com/microsoft/WindowsAppSDK-Samples/blob/main/Samples/BackgroundTask/InProc%20BackgroundTask/cs-winui/BackgroundTaskBuilder/BackgroundTask.cs#L21). +The following example shows how to implement **IBackgroundTask** using C#. In the Windows App SDK github sample, you can see this implementation code in [BackgroundTask.cs](https://github.com/microsoft/WindowsAppSDK-Samples/blob/main/Samples/BackgroundTask/InProc%20BackgroundTask/cs-winui/BackgroundTaskBuilder/BackgroundTask.cs#L21). ```csharp [ComVisible(true)] @@ -332,7 +332,7 @@ static partial class ComServer out uint registrationToken); [LibraryImport("ole32.dll")] - public static partial int CoRevokeObject(out uint registrationToken); + public static partial int CoRevokeClassObject(uint registrationToken); public const uint CLSCTX_LOCAL_SERVER = 4; public const uint REGCLS_MULTIPLEUSE = 1; @@ -398,7 +398,7 @@ public App() ~App() { - ComServer.CoRevokeObject(out _RegistrationToken); + ComServer.CoRevokeClassObject(_RegistrationToken); } ``` diff --git a/hub/apps/windows-app-sdk/applifecycle/focus-session.md b/hub/apps/windows-app-sdk/applifecycle/focus-session.md index 4edbc31e95..ff79bc2295 100644 --- a/hub/apps/windows-app-sdk/applifecycle/focus-session.md +++ b/hub/apps/windows-app-sdk/applifecycle/focus-session.md @@ -76,7 +76,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) { var manager = Windows.UI.Shell.FocusSessionManager.GetDefault(); manager.IsFocusActiveChanged += Manager_IsFocusActiveChanged; - SetAnimatedGifAutoPlay(true); + SetAnimatedGifAutoPlay(!manager.IsFocusActive); } } @@ -84,11 +84,11 @@ private void Manager_IsFocusActiveChanged(Windows.UI.Shell.FocusSessionManager s { if(sender.IsFocusActive) { - SetAnimatedGifAutoPlay(true); + SetAnimatedGifAutoPlay(false); } else { - SetAnimatedGifAutoPlay(false); + SetAnimatedGifAutoPlay(true); } } ``` @@ -97,7 +97,7 @@ private void Manager_IsFocusActiveChanged(Windows.UI.Shell.FocusSessionManager s ```cpp // pch.h ... -#include #include // MainWindow.xaml.h @@ -119,7 +119,7 @@ void MainWindow::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArg m_focusStateChangedToken = m_focusSessionManager.IsFocusActiveChanged( { get_weak(), &MainWindow::OnFocusStateChanged }); - SetAnimatedGifAutoPlay(true); + SetAnimatedGifAutoPlay(!m_focusSessionManager.IsFocusActive()); } } @@ -127,7 +127,7 @@ void MainWindow::OnFocusStateChanged(Windows::UI::Shell::FocusSessionManager con Windows::Foundation::IInspectable const&) { auto temp = m_focusSessionManager.IsFocusActive(); - SetAnimatedGifAutoPlay(m_focusSessionManager.IsFocusActive()); + SetAnimatedGifAutoPlay(!m_focusSessionManager.IsFocusActive()); } ```