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
2 changes: 1 addition & 1 deletion hub/apps/develop/data-access/sql-server-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ This XAML creates a [ListView](/windows/windows-app-sdk/api/winrt/microsoft.ui.x

### Show products in the ListView

Open the **MainWindow.xaml.cs** file, and add code to the constructor of the `MainWindow` class that sets the **ItemSource** property of the [ListView](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.listview) to the [ObservableCollection](/dotnet/api/system.collections.objectmodel.observablecollection-1) of `Product` instances.
Open the **MainWindow.xaml.cs** file, and add code to the constructor of the `MainWindow` class that sets the **ItemsSource** property of the [ListView](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.listview) to the [ObservableCollection](/dotnet/api/system.collections.objectmodel.observablecollection-1) of `Product` instances.

```csharp
public MainWindow()
Expand Down
2 changes: 1 addition & 1 deletion hub/apps/develop/data-access/sqlite-data-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public async static void InitializeDatabase()

This code creates the SQLite database and stores it in the application's local data store.

In this example, we name the database `sqlliteSample.db` but you can use whatever name you want as long as you use that name in all [SqliteConnection](/dotnet/api/microsoft.data.sqlite.sqliteconnection) objects that you instantiate. In a production application, connection information such as the database filename should be stored in app configuration rather than hard-coded (see [**Adding Azure App Configuration by using Visual Studio Connected Services**](/visualstudio/azure/vs-azure-tools-connected-services-app-configuration)).
In this example, we name the database `sqliteSample.db` but you can use whatever name you want as long as you use that name in all [SqliteConnection](/dotnet/api/microsoft.data.sqlite.sqliteconnection) objects that you instantiate. In a production application, connection information such as the database filename should be stored in app configuration rather than hard-coded (see [**Adding Azure App Configuration by using Visual Studio Connected Services**](/visualstudio/azure/vs-azure-tools-connected-services-app-configuration)).

In the constructor of the **App.xaml.cs** file of your project, call the `InitializeDatabase` method of the `DataAccess` class. This will ensure that the database is created or opened each time the app starts.

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/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ namespace WinUITest1
```csharp
namespace WinUICLassLibrary1
{
public sealed partial class UserControll : UserControl
public sealed partial class UserControl1 : UserControl
{
public UserControl1()
{
Expand Down
4 changes: 2 additions & 2 deletions hub/apps/develop/ui/controls/listview-filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ For filtering to work, the ListView must have a data source that can be manipula

To start, you'll need to initialize your original data source in a separate collection, such as a [List\<T>](/dotnet/api/system.collections.generic.list-1). In this example, you have a `List<Contact>` called `allContacts` that holds all of the `Contact` objects that can potentially be shown in the ListView.

You'll also need a collection to hold the filtered data, which will constantly change every time a filter is applied. For this, you'll use an [ObservableCollection\<T>](/dotnet/api/system.collections.objectmodel.observablecollection-1) so that the ListView is notified to update whenever the collection changes. In this example, it's an `ObservableCollection<Person>` called `contactsFiltered`, and is the [ItemsSource](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.itemscontrol.itemssource) for the ListView. At initialization, it will have the same contents as `allContacts`.
You'll also need a collection to hold the filtered data, which will constantly change every time a filter is applied. For this, you'll use an [ObservableCollection\<T>](/dotnet/api/system.collections.objectmodel.observablecollection-1) so that the ListView is notified to update whenever the collection changes. In this example, it's an `ObservableCollection<Contact>` called `contactsFiltered`, and is the [ItemsSource](/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.itemscontrol.itemssource) for the ListView. At initialization, it will have the same contents as `allContacts`.

The filtering operation is performed through these steps, shown in the following code:

Expand Down Expand Up @@ -87,7 +87,7 @@ public sealed partial class MainPage : Page
// contactsFiltered). Set this newly populated collection as the
// ItemsSource for the ListView.
contactsFiltered = new ObservableCollection<Contact>(allContacts);
Filtereditemscontrol.itemssource = contactsFiltered;
FilteredListView.ItemsSource = contactsFiltered;
}

// Whenever text changes in the filtering text box, this function is called:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The `share_target` member must contain the necessary information for the system
},
```

When your app is selected by the user as the target for shared content, the PWA is launched. A `GET` HTTP request is made to the URL specified by the `action` property. The shared data is passed as the `title`, `text`, and `url` query parameters. The following request is made: `/handle-shared-content/?title=shared title&text=shared text&url=shared url`.
When your app is selected by the user as the target for shared content, the PWA is launched. A `POST` HTTP request is made to the URL specified by the `action` property. The shared data is posted to that URL when the share target is invoked.

The following example illustrates how to register the scoped service worker:

Expand Down
2 changes: 1 addition & 1 deletion 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
10 changes: 5 additions & 5 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 Down Expand Up @@ -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