Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hub/apps/design/layout/attached-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ With an attached layout, a single instance of the layout object may be associate
<!-- ... --->
<Page.Resources>
<ExampleLayout x:Name="exampleLayout"/>
<Page.Resources>
</Page.Resources>

<LayoutPanel x:Name="example1" Layout="{StaticResource exampleLayout}"/>
<LayoutPanel x:Name="example2" Layout="{StaticResource exampleLayout}"/>
Expand Down Expand Up @@ -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)**

Expand Down
2 changes: 1 addition & 1 deletion hub/apps/design/layout/boxpanel-example-custom-panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion hub/apps/desktop/modernize/ui/apply-windows-themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion hub/apps/develop/communication/copy-and-paste.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion hub/apps/develop/platform/xaml/3-d-perspective-effects.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Notice how the image rotates around the center when the [**CenterOfRotationY**](
```xml
<Image Source="kid.png">
<Image.Projection>
<PlaneProjection RotationY="-35" CenterOfRotationX="0.5" />
<PlaneProjection RotationY="-35" CenterOfRotationX="0.9" />
</Image.Projection>
</Image>
```
Expand Down
2 changes: 1 addition & 1 deletion hub/apps/develop/platform/xaml/transforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
14 changes: 7 additions & 7 deletions hub/apps/windows-app-sdk/applifecycle/applifecycle-instancing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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();
Expand All @@ -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)
Expand All @@ -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();
}
Expand Down Expand Up @@ -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()
Expand All @@ -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)
8 changes: 4 additions & 4 deletions hub/apps/windows-app-sdk/applifecycle/applifecycle-power.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions hub/apps/windows-app-sdk/applifecycle/background-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -398,7 +398,7 @@ public App()

~App()
{
ComServer.CoRevokeObject(out _RegistrationToken);
ComServer.CoRevokeClassObject(_RegistrationToken);
}
```

Expand Down
12 changes: 6 additions & 6 deletions hub/apps/windows-app-sdk/applifecycle/focus-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
{
var manager = Windows.UI.Shell.FocusSessionManager.GetDefault();
manager.IsFocusActiveChanged += Manager_IsFocusActiveChanged;
SetAnimatedGifAutoPlay(true);
SetAnimatedGifAutoPlay(!manager.IsFocusActive);
}
}

private void Manager_IsFocusActiveChanged(Windows.UI.Shell.FocusSessionManager sender, object args)
{
if(sender.IsFocusActive)
{
SetAnimatedGifAutoPlay(true);
SetAnimatedGifAutoPlay(false);
}
else
{
SetAnimatedGifAutoPlay(false);
SetAnimatedGifAutoPlay(true);
}
}
```
Expand All @@ -97,7 +97,7 @@ private void Manager_IsFocusActiveChanged(Windows.UI.Shell.FocusSessionManager s
```cpp
// pch.h
...
#include <winrt/Windows.UI.Shell.h
#include <winrt/Windows.UI.Shell.h>
#include <winrt/Windows.UI.Xaml.Navigation.h>

// MainWindow.xaml.h
Expand All @@ -119,15 +119,15 @@ void MainWindow::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArg
m_focusStateChangedToken = m_focusSessionManager.IsFocusActiveChanged(
{ get_weak(), &MainWindow::OnFocusStateChanged });

SetAnimatedGifAutoPlay(true);
SetAnimatedGifAutoPlay(!m_focusSessionManager.IsFocusActive());
}
}

void MainWindow::OnFocusStateChanged(Windows::UI::Shell::FocusSessionManager const& sender,
Windows::Foundation::IInspectable const&)
{
auto temp = m_focusSessionManager.IsFocusActive();
SetAnimatedGifAutoPlay(m_focusSessionManager.IsFocusActive());
SetAnimatedGifAutoPlay(!m_focusSessionManager.IsFocusActive());
}
```

Expand Down