Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c2d827f
Add archived content from 7.x docs with notice headers
Arlodotexe Sep 16, 2025
dc1062a
Remove stray copied file
Arlodotexe Sep 16, 2025
6dae3c2
Fix validation warnings/errors: broken links, absolute links, H1s, ta…
Arlodotexe Sep 17, 2025
91968ac
Add 45 archive redirect entries for naming validation compliance
Arlodotexe Sep 17, 2025
6ea9d60
Add redirect entry for datagrid guidance documentation
Arlodotexe Sep 17, 2025
b24743b
Renamed files to comply with `folder-name-invalid-character` and `fil…
Arlodotexe Sep 18, 2025
49e0596
Update relative links to renamed archive content
Arlodotexe Sep 18, 2025
eb4f4df
Cleanup corrupted link artifacts at ends of file
Arlodotexe Sep 18, 2025
3a0cce0
Remove duplicated unreferenced and misnamed file
Arlodotexe Sep 18, 2025
8f95bd3
Revert "Add redirect entry for datagrid guidance documentation"
Arlodotexe Sep 18, 2025
89bd05d
Revert "Add 45 archive redirect entries for naming validation complia…
Arlodotexe Sep 18, 2025
27e8537
Add missing image, fix broken image link
Arlodotexe Sep 18, 2025
1ea45f0
Renamed files to comply with `filename-invalid-character`
Arlodotexe Sep 18, 2025
5c963ac
Fixed malformed table headers
Arlodotexe Sep 18, 2025
779be61
Restructure: Move archive from /windows/archive/ to /archive/windows/…
Arlodotexe Oct 13, 2025
9fea035
Convert archive doc warnings to DocFX alert syntax
Arlodotexe Nov 8, 2025
b91a634
Update docs/archive/windows/datagrid.md
Arlodotexe Dec 26, 2025
f16c61f
Add links to archived root DataGrid concept doc
Arlodotexe Dec 26, 2025
1df1710
Merge branch 'wct/new/archive/7x' of https://github.com/Arlodotexe/Co…
Arlodotexe Dec 26, 2025
68abb88
Merge branch 'main' into wct/new/archive/7x
Arlodotexe Dec 26, 2025
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
207 changes: 207 additions & 0 deletions docs/archive/windows/backgroundtaskhelper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
---
title: Background Task Helper
author: nmetulev
description: The Background Task Helper helps users interact with background tasks in an easier manner.
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, Background Task Helper
dev_langs:
- csharp
- vb
---

# Background Task Helper (Archived)

> [!WARNING]
> This document has been archived and the component is not available in the current version of the Windows Community Toolkit.
>
> While there are no immediate plans to port this component to 8.x, the community is welcome to express interest or contribute to its inclusion.
>
> For more information:
> - [Community Toolkit GitHub repository](https://github.com/CommunityToolkit/Windows)
> - [Documentation feedback and suggestions](https://github.com/MicrosoftDocs/CommunityToolkit/issues)
>
> Original documentation follows below.

---

The [Background Task Helper](/dotnet/api/microsoft.toolkit.uwp.helpers.backgroundtaskhelper) helps users interact with background tasks in an easier manner.

> [!div class="nextstepaction"]
> [Try it in the sample app](uwpct://Helpers?sample=BackgroundTaskHelper)

## Syntax

```csharp
using Microsoft.Toolkit.Uwp;

BackgroundTaskRegistration registered = BackgroundTaskHelper.Register(typeof(BackgroundTaskClass), new TimeTrigger(15, true));
BackgroundTaskRegistration registered = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", new TimeTrigger(15, true));
```

```vb
Imports Microsoft.Toolkit.Uwp

Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass), New TimeTrigger(15, True))
Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", New TimeTrigger(15, True))
```

## Methods

| Methods | Return Type | Description |
| -- | -- | -- |
| GetBackgroundTask(String) | [IBackgroundTaskRegistration](/uwp/api/Windows.ApplicationModel.Background.IBackgroundTaskRegistration) | Get the registered background task of the given type |
| GetBackgroundTask(Type) | IBackgroundTaskRegistration | Get the registered background task of the given type |
| IsBackgroundTaskRegistered(String) | bool | Check if a background task is registered |
| IsBackgroundTaskRegistered(Type) | bool | Check if a background task is registered |
| Register(String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[]) | [BackgroundTaskRegistration](/uwp/api/Windows.ApplicationModel.Background.BackgroundTaskRegistration) | Registers under the Single Process Model |
| Register(Type, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[]) | BackgroundTaskRegistration | Register a background task with conditions |
| Register(String, String, IBackgroundTrigger, Boolean, Boolean, IBackgroundCondition[]) | BackgroundTaskRegistration | Register a background task with conditions |
| Unregister(String, Boolean) | void | Unregister a background task |
| Unregister(Type, Boolean) | void | Unregister a background task |
| Unregister(IBackgroundTaskRegistration, Boolean) | void | Unregister a background task |

## Example

### Using Multi-Process Model

Using MPM (Multi-Process Model) is the classic way of using Background Task.

To make it work, you will need :

* To create Background Tasks in a Windows Runtime Component
* To register the Background Tasks in the package manifest (appxmanifest file)

Once it is done, you can register your Background Tasks.

```csharp
// Be sure to include the using at the top of the file:
using Microsoft.Toolkit.Uwp;
using Windows.ApplicationModel.Background;

// Register a normal, separate process, background task
BackgroundTaskRegistration registered = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", new TimeTrigger(15, true));

// This can also be written using the overload of Register with Type parameter.
BackgroundTaskRegistration registered = BackgroundTaskHelper.Register(typeof(BackgroundTaskClass), new TimeTrigger(15, true));

// With condition
BackgroundTaskRegistration registered =
BackgroundTaskHelper.Register(typeof(BackgroundTaskClass),
new TimeTrigger(15, true),
false, true,
new SystemCondition(SystemConditionType.InternetAvailable));

// 2 or more conditions
BackgroundTaskRegistration registered =
BackgroundTaskHelper.Register(typeof(BackgroundTaskClass),
new TimeTrigger(15, true),
false, true,
new SystemCondition(SystemConditionType.InternetAvailable),
new SystemCondition(SystemConditionType.UserPresent));
```

```vb
' Be sure to include the Imports at the top of the file:
Imports Microsoft.Toolkit.Uwp
Imports Windows.ApplicationModel.Background

' Register a normal, separate process, background task
Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register("TaskName", "TaskEntryPoint", New TimeTrigger(15, True))

' This can also be written using the overload of Register with Type parameter.
Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass), New TimeTrigger(15, True))

' With condition
Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass),
New TimeTrigger(15, True),
False,
True,
New SystemCondition(SystemConditionType.InternetAvailable))

' 2 or more conditions
Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register(GetType(BackgroundTaskClass),
New TimeTrigger(15, True),
False,
True,
New SystemCondition(SystemConditionType.InternetAvailable),
New SystemCondition(SystemConditionType.UserPresent))
```

### Using Single-Process Model

Using SPM (Single-Process Model) is the new and simple way of using Background Task.
It is required to target Anniversary Update (SDK 14393) or later.

Using SPM, you can declare your Background Tasks inside your own project, no need to create a Windows Runtime Component.
Moreover, it is no longer required to register the Background Tasks in the package manifest (appxmanifest file).

Once you have created the Background Task, you can register it by calling the `Register` method.

```csharp
// Be sure to include the using at the top of the file:
using Microsoft.Toolkit.Uwp;
using Windows.ApplicationModel.Background;

// Register a single process background task (Anniversary Update and later ONLY)
BackgroundTaskRegistration registered = BackgroundTaskHelper.Register("Name of the Background Task", new TimeTrigger(15, true));
```

```vb
' Be sure to include the imports at the top of the file:
Imports Microsoft.Toolkit.Uwp
Imports Windows.ApplicationModel.Background

' Register a single process background task (Anniversary Update and later ONLY)
Dim registered As BackgroundTaskRegistration = BackgroundTaskHelper.Register("Name of the Background Task", New TimeTrigger(15, True))
```

The other difference between SPM and MPM is that in SPM, you have to handle your Background Tasks inside the `OnBackgroundActivated` event of `App.xaml.cs` class.
Here is an example of how to handle Background Tasks in SPM.

```csharp
// Event fired when a Background Task is activated (in Single Process Model)
protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);

var deferral = args.TaskInstance.GetDeferral();

switch (args.TaskInstance.Task.Name)
{
case "Name of the Background Task":
new TestBackgroundTask().Run(args.TaskInstance);
break;
}

deferral.Complete();
}
```

```vb
Protected Overrides Sub OnBackgroundActivated(ByVal args As BackgroundActivatedEventArgs)
MyBase.OnBackgroundActivated(args)

Dim deferral = args.TaskInstance.GetDeferral()

Select Case args.TaskInstance.Task.Name
Case "Name of the Background Task"
New TestBackgroundTask().Run(args.TaskInstance)
End Select

deferral.Complete()
End Sub
```

## Sample Project

[Background Task Helper](https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/rel/7.1.0/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/BackgroundTaskHelper). You can [see this in action](uwpct://Helpers?sample=BackgroundTaskHelper) in the [Windows Community Toolkit Sample App](https://aka.ms/windowstoolkitapp).

## Requirements

| Device family | Universal, 10.0.16299.0 or higher |
| --- | --- |
| Namespace | Microsoft.Toolkit.Uwp |
| NuGet package | [Microsoft.Toolkit.Uwp](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp/) |

## API

* [Background Task source code](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/rel/7.1.0/Microsoft.Toolkit.Uwp/Helpers/BackgroundTaskHelper.cs)
77 changes: 77 additions & 0 deletions docs/archive/windows/bindablevalueholder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: BindableValueHolder
author: nmetulev
description: The BindableValueHolder lets users change several objects' states at a time.
keywords: windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, BindableValueHolder
---

# BindableValueHolder (Archived)

> [!WARNING]
> This document has been archived and the component is not available in the current version of the Windows Community Toolkit.
>
> While there are no immediate plans to port this component to 8.x, the community is welcome to express interest or contribute to its inclusion.
>
> For more information:
> - [Community Toolkit GitHub repository](https://github.com/CommunityToolkit/Windows)
> - [Documentation feedback and suggestions](https://github.com/MicrosoftDocs/CommunityToolkit/issues)
> - [GitHub issue #491](https://github.com/CommunityToolkit/Windows/issues/491) (Documentation mapping and porting)
>
> Original documentation follows below.

---

The [BindableValueHolder](/dotnet/api/microsoft.toolkit.uwp.ui.helpers.bindablevalueholder) lets users change several objects' states at a time.

## Syntax

```xaml
<helpers:BindableValueHolder x:Name="BindName" Value="{StaticResource BindValue}" />
```

## Properties

| Property | Type | Description |
| -- | -- | -- |
| Value | object | Gets or sets the held value |

## Example

You can use it to switch several object states by declaring it as a Resource (either in a page or control):

```xaml
<helpers:BindableValueHolder x:Name="HighlightBrushHolder" Value="{StaticResource BlackBrush}" />
```

and using it like that:

```xaml
<TextBlock x:Name="Label" Foreground="{Binding Value, ElementName=HighlightBrushHolder}" />

<TextBox x:Name="Field" BorderBrush="{Binding Value, ElementName=HighlightBrushHolder}" />
```

and switching it like that:

```xaml
<VisualStateGroup x:Name="HighlightStates">
<VisualState x:Name="Normal" />

<VisualState x:Name="Wrong">
<VisualState.Setters>
<Setter Target="HighlightBrushHolder.Value" Value="{StaticResource RedBrush}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
```

## Requirements

| Device family | Universal, 10.0.16299.0 or higher |
| --- | --- |
| Namespace | Microsoft.Toolkit.Uwp.UI |
| NuGet package | [Microsoft.Toolkit.Uwp.UI](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI/) |

## API

* [BindableValueHolder source code](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/rel/7.1.0/Microsoft.Toolkit.Uwp.UI/Helpers/BindableValueHolder.cs)
Loading