Skip to content

Commit 1faffb9

Browse files
committed
Port input focus to C# sample
1 parent 2bd0571 commit 1faffb9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Samples/Islands/DrawingIsland/DrawingCppTestApp/WinMain.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespace winrt
77
{
8-
using namespace Microsoft::UI;
98
using namespace Microsoft::UI::Composition;
109
using namespace Microsoft::UI::Content;
1110
using namespace Microsoft::UI::Dispatching;

Samples/Islands/DrawingIsland/DrawingCsTestApp/Program.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System;
2-

3-
using Microsoft.UI;
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
44
using Microsoft.UI.Composition;
55
using Microsoft.UI.Content;
66
using Microsoft.UI.Dispatching;
@@ -30,6 +30,11 @@
3030
siteBridge.Show();
3131
siteBridge.Connect(drawing.Island);
3232

33+
// Move initial focus to the island.
34+
var focusNavigationHost = InputFocusNavigationHost.GetForSiteBridge(siteBridge);
35+
focusNavigationHost.NavigateFocus(FocusNavigationRequest.Create(
36+
FocusNavigationReason.Programmatic));
37+
3338
queue.RunEventLoop();
3439

3540
controller.ShutdownQueue();

0 commit comments

Comments
 (0)