Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7d151b5
chore(todo-app): fixed common markdownlint and added alt text require…
DevTKSS Mar 30, 2025
a7696b5
docs(todo-app): fixed common markdownlint and added md code pages to …
DevTKSS Mar 30, 2025
a99cebe
Merge branch 'docs-fix-links-and-lintings' of https://github.com/DevT…
DevTKSS Mar 30, 2025
1b3d19d
chore(deps): updated PackageReference to recommended Microsoft.Identi…
DevTKSS Apr 1, 2025
96dbbcf
fix(Logging): Fixed App complaining about InitializeLogging would be …
DevTKSS Apr 1, 2025
7adeccb
chore: formatted dotnet new left replacement tokens by their equal th…
DevTKSS Apr 1, 2025
ad39983
docs(ToDo-App): Added first part of explaination to serialization wit…
DevTKSS Apr 1, 2025
85cf6a7
chore(deps): Bump all reference Sample Uno.Sdk version to latest 5.6.51
DevTKSS Apr 1, 2025
69522c5
chore(ToDo-App-Serialization): Temp marked JsonIgnoreCondition compar…
DevTKSS Apr 1, 2025
cc31042
Merge branch 'unoplatform:master' into docs-fix-links-and-lintings
DevTKSS Apr 21, 2025
487dc01
Merge branch 'master' into docs-fix-links-and-lintings
DevTKSS Jun 19, 2025
083d69c
Merge branch 'master' into docs-fix-links-and-lintings
DevTKSS Nov 22, 2025
81244f9
chore(ToDo): Add topicHref element to the TOC to provide a landing page
DevTKSS Nov 22, 2025
73654a9
chore: applying PR rewording suggestion
DevTKSS Nov 22, 2025
1c7522f
chore: applying PR rewording suggestion
DevTKSS Nov 22, 2025
1e92e1a
chore: applying PR rewording suggestion
DevTKSS Nov 22, 2025
7610a9f
chore: applying PR rewording suggestion
DevTKSS Nov 22, 2025
ebcb1ef
chore: applying PR rewording suggestion
DevTKSS Nov 22, 2025
8000419
chore: InitializeLogging from Programm.cs
DevTKSS Nov 22, 2025
29113ca
chore: apply review suggestion
DevTKSS Nov 22, 2025
bb86d48
chore: apply review suggestion
DevTKSS Nov 22, 2025
b7aabe9
chore: fix typo
DevTKSS Nov 22, 2025
21c54e7
docs: Update guide for Record definition using Configuration
DevTKSS Nov 22, 2025
825de0e
chore: remove duplicated xref
DevTKSS Dec 2, 2025
f1e0fb6
revert: Update Readme links
DevTKSS Dec 2, 2025
6e91201
chore: Update Readme links
DevTKSS Dec 2, 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
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false

[*.md]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
uid: Uno.Samples.Readme
---
# Uno Platform Samples

This repository provides simple, to-the-point code [samples](#samples) for the [Uno Platform](https://platform.uno/).

<p align="center">
<img width="50" src="https://uno-assets.platform.uno/logos/uno_background.png" />
<img width="50" src="https://uno-assets.platform.uno/logos/uno_background.png" alt="Colorful but simple Uno Platform logo with interlocking blue, pink, green, and purple shapes." />
</p>

<h2 align="center">Pixel-Perfect. Multi-Platform. C# & Windows XAML. Today.</h2>
Expand All @@ -29,16 +32,18 @@ Visit [our documentation](https://aka.platform.uno/uno-docs-intro) for more deta

## Samples

See a complete list of code samples [here](doc/samples.md). Some of the samples have accompanying step-by-step [workshops](https://aka.platform.uno/counter-tutorial) or [tutorials](https://aka.platform.uno/tutorials-intro) in the official Uno Platform documentation.
See a complete list of code samples [here](xref:Uno.Samples). Some of the samples have accompanying step-by-step [workshops](https://aka.platform.uno/counter-tutorial) or [tutorials](https://aka.platform.uno/tutorials-intro) in the official Uno Platform documentation.

### Uno Platform Samples - Issues

If you encounter any issues with these samples above, please open an issue [here](https://github.com/unoplatform/uno/issues).

## Have other questions? Feature requests? Issues?

Make sure to visit our [FAQ](https://aka.platform.uno/uno-faq), [create an issue](https://github.com/unoplatform/uno/issues), [open a GitHub Discussion](https://github.com/unoplatform/uno/discussions) or visit our [Discord Server](https://platform.uno/uno-discord) - where our engineering team and community will be able to help you.

## Contributors

Thanks go to these wonderful people (List made with [contrib.rocks](https://contrib.rocks)):

[![Uno.Samples Contributors](https://contrib.rocks/image?repo=unoplatform/Uno.Samples)](https://github.com/unoplatform/Uno.Samples/graphs/contributors)
Expand Down
19 changes: 10 additions & 9 deletions doc/samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Browse the complete list below:
### Counter App

Experience the simplicity and power of Uno.Extensions through the Counter App, a straightforward yet powerful demonstration of both basic and advanced features of the Uno Platform. This app provides a hands-on experience with fundamental concepts such as state management, user interaction, and real-time UI updates.
This sample app was built using the four variants of the [Counter workshop](https://aka.platform.uno/counter-tutorial), combining markup language (XAML or C# Markup) and presentation framework (MVVM or MVUX).
This sample app was built using the four variants of the [Counter workshop](xref:Uno.Workshop.Counter), combining markup language (XAML or C# Markup) and presentation framework (MVVM or MVUX).

[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/reference/Counter)

Expand All @@ -25,7 +25,7 @@ The SimpleCalc App is a sample application designed to perform basic arithmetic

### TubePlayer App

The TubePlayer App is a sample application that allows users to search for, and stream Youtube videos. This app was created using the tools, libraries, and patterns provided by the Uno Platform, designed to facilitate the rapid development of high-quality applications.
The TubePlayer App is a sample application that allows users to search for, and stream YouTube videos. This app was created using the tools, libraries, and patterns provided by the Uno Platform, designed to facilitate the rapid development of high-quality applications.
This sample app was built following the [Tube Player workshop](https://aka.platform.uno/tubeplayer-workshop).

[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/reference/TubePlayer)
Expand All @@ -38,13 +38,14 @@ The [Chefs app](xref:Uno.Chefs.Overview) is an engaging recipe platform where yo

### Commerce App

The Commerce App is a sample application that demonstrates the use of ListFeed pagination, Feedviews, and other features provided by Uno.Extensions. It illustrates how these features can be applied to create an application complete with a shopping cart, products, and more.
The Commerce App is a sample application that demonstrates the use of ListFeed pagination, FeedViews, and other features provided by Uno.Extensions. It illustrates how these features can be applied to create an application complete with a shopping cart, products, and more.

[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/reference/Commerce)

### ToDo App

Dive into the essentials of task management with the ToDo App, a meticulously crafted sample application that highlights the power and flexibility of Uno.Extensions. By emphasizing the creation and organization of to-do lists, this app showcases practical applications of essential Uno.Extensions features, offering a hands-on experience in crafting responsive and user-friendly interfaces across multiple platforms.
This Sample App Contents can be reviewed [here](xref:Uno.Workshops.ToDo-App.Overview)

[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/reference/ToDo)

Expand Down Expand Up @@ -84,7 +85,7 @@ An implementation of the .NET Benchmark Control, a performance comparison tool.

A sample that allows the user to search for nearby Bluetooth connections and connect to a device of their choice. Uses [InTheHand.BluetoothLE](https://www.nuget.org/packages/InTheHand.BluetoothLE).

[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/UI/BluetoothExplorer)
[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/UI/BluetoothExplorer)

### Camera Capture UI

Expand Down Expand Up @@ -336,15 +337,15 @@ Uno PongWars is a simple minigame that draws inspiration from the [PongWars HTML

Three sample apps are available:

1. **Quickstart sample**
1. **Quickstart sample**
This sample app was created by following the [ScottPlot Uno Platform Quickstart documentation](https://scottplot.net/quickstart/unoplatform).

2. **Signal plot with 5 million points sample**
This sample app was created the same way by following the [ScottPlot Uno Platform Quickstart documentation](https://scottplot.net/quickstart/unoplatform).
2. **Signal plot with 5 million points sample**
This sample app was created the same way by following the [ScottPlot Uno Platform Quickstart documentation](https://scottplot.net/quickstart/unoplatform).
Only the code-behind differs to display a signal plot with 5 million random points.

3. **SQLite Data Persistence and Large Dataset Visualization Sample**
This sample demonstrates how to combine SQLite for database-driven data persistence with ScottPlot for visualizing large datasets.
3. **SQLite Data Persistence and Large Dataset Visualization Sample**
This sample demonstrates how to combine SQLite for database-driven data persistence with ScottPlot for visualizing large datasets.
It showcases how to handle and visualize different plot types while persisting the data in a database for long-term storage.

[Browse source](https://github.com/unoplatform/Uno.Samples/tree/master/UI/ScottPlot) | [Follow the quickstart tutorial](https://scottplot.net/quickstart/unoplatform)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
uid: Uno.Workshops.Counter.Overview
---
# Counter App

Discover the simplicity and power of Uno.Extensions with the Counter App, a straightforward yet powerful demonstration of basic and advanced features of the Uno Platform. This app provides a hands-on experience with fundamental concepts such as state management, user interaction, and UI updates in real-time.
Expand All @@ -20,4 +23,4 @@ This sample app was built using the four variants of the [Counter workshop](http
## What is the Uno Platform

[Uno Platform](https://platform.uno) is an open-source .NET platform for building single codebase native mobile, web, desktop, and embedded apps quickly.
For additional information about Uno Platform or if you have any feedback to share, please refer to the [README.md](../../README.md) file in this Samples repository.
For additional information about Uno Platform or if you have any feedback to share, please refer to the [README.md](xref:Uno.Samples.Readme) file in this Samples repository.
31 changes: 31 additions & 0 deletions reference/ToDo/Overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
uid: Uno.Workshops.ToDo-App.Overview
---
# ToDo App Overview

<p align="center">
<img src="doc/assets/ToDoApp_Banner.png" alt="Introducing centered Banner Image. On the left, there's a large checkmark icon inside a purple circle, set against a violet background. Next to it, bold white text reads 'To Do App.' On the right side, three stylized smartphone screens display different app views, including a welcome screen, a task list, and an 'Important' tasks section. The Uno Platform logo appears in the top-right corner. Colorful dots scattered in the background add a modern and vibrant touch">
</p>

Uno ToDo App is a beautifully designed sample for [Uno Platform](https://platform.uno/) using the latest [Material Design 3 system](https://m3.material.io/).

The design template makes it easy to jump-start or learn Uno Platform-powered mobile, web, and desktop applications. The app provides common functions such as logging on, recording tasks, adding due dates, setting reminders, and more.

In addition, the sample code utilizes [Uno.Extensions](https://aka.platform.uno/uno-extensions) and establishes the best practices for cross-platform application design and development considering multiple screen sizes, accessibility, enforcing brand guidelines, and more.

![ToDoApp Gif](doc/assets/ToDoApp.gif)

## Table of Contents <!--TODO: Transfer this to code-csharp Snippets on separate pages or even better create a real workshop-->

* [Defining Records loaded by Configuration as `IOptions`](xref:Uno.Workshops.ToDo-App.DefiningConfigurationLoadedRecord)
* [Accessing tokens with Authentication](xref:Uno.Workshops.ToDo-App.AccessingAuthTokens)
* [Common Navigation](xref:Uno.Workshops.ToDo-App.Common-Navigation)
* [Changing the language with Localization via the model](xref:Uno.Workshops.ToDo-App.LocalizeByModel).
* [Adapting the language in the Xaml with Localization via `x:Uid`](xref:Uno.Workshops.ToDo-App.LocalizeWithUid)
* [Theme switching with ThemeService](xref:Uno.Workshops.ToDo-App.Theme-Switching-by-ThemeService)
* [Reactive ListFeeds with FeedViews](xref:Uno.Workshops.ToDo-App.Reactive-ListFeeds-FeedViews)

## What is the Uno Platform

[Uno Platform](https://platform.uno) is an open-source .NET platform for building single codebase native mobile, web, desktop, and embedded apps quickly.
For additional information about Uno Platform or if you have any feedback to share, please refer to the [README.md](xref:Uno.Samples.Readme) file in this Samples repository.
28 changes: 0 additions & 28 deletions reference/ToDo/README.md

This file was deleted.

6 changes: 6 additions & 0 deletions reference/ToDo/doc/accessing-auth-tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
uid: Uno.Workshops.ToDo-App.AccessingAuthTokens
---
# Accessing Tokens with Authentication

[!code-csharp[](../src/ToDo/Presentation/WelcomeViewModel.cs)]
16 changes: 16 additions & 0 deletions reference/ToDo/doc/common-navigation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
uid: Uno.Workshops.ToDo-App.Common-Navigation
---
# Common Navigation

## The Task Page

[!code-xaml[](../src/ToDo/Views/TaskListPage.xaml)]

## Code-Behind of List Page

[!code-csharp[](../src/ToDo/Views/TaskListPage.xaml.cs)]

## View Model of Task Page

[!code-csharp[](../src/ToDo/Presentation/TaskListViewModel.cs)]
106 changes: 106 additions & 0 deletions reference/ToDo/doc/define-records-loaded-by-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
uid: Uno.Workshops.ToDo-App.DefiningConfigurationLoadedRecord
---

# Authentication Options via `IOptions` and `appsettings.json`

This sample demonstrates how to define immutable authentication options as `record`, load them from `appsettings.json` using [Uno.Extensions.Configuration](xref:Uno.Extensions.Configuration.Overview) `UseConfiguration(...).Section<T>()` and consume them inside of an `AuthenticationService` which will be used in this Sample app.

## 1. Defining the `Auth` record

Your JSON file(s) will consist of a serialized representation of multiple properties and their values. Hence, configuration sections allow you to programmatically read a specific subset of these properties from the instantiated class that represents them.

To ensure immutability while still allowing the configuration binder to populate values, the record must expose *init-only* properties.
A primary constructor **cannot** be used, because the configuration binder requires a parameterless constructor and settable properties.

Author a new class or record with related properties to be used for configuration:

```csharp
public partial record Auth
{
public string? ApplicationId { get; init; }
public string[]? Scopes { get; init; }
public string? RedirectUri { get; init; }
public string? KeychainSecurityGroup { get; init; }
}
```

The following form **does not work** with `IOptions`, even if all parameters are nullable:

```csharp
public partial record Auth(string? ApplicationId, string[]? Scopes, string? RedirectUri, string? KeychainSecurityGroup);
```

The binder cannot map configuration values into primary-constructor parameters.

> [!TIP]
> If you want to keep the Types non-nullable and depending on their implementation, you can apply default values like:
> ```csharp
> public partial record Auth
> {
> public string ApplicationId { get; init; } = string.Empty;
> public string[]? Scopes { get; init; } = [];
> public string RedirectUri { get; init; } = string.Empty;
> public string KeychainSecurityGroup { get; init; } = string.Empty;
> }
> ```

## 2. Add the configuration settings into your `appsettings.json` file

```json
{
"Auth": {
"ApplicationId": "my-app-id",
"Scopes": [ "openid", "profile" ],
"RedirectUri": "myapp://auth",
"KeychainSecurityGroup": "com.company.myapp"
}
}
```

> [!WARNING]
> Especially for Authentication related Data which includes sensitive credentials like Client ID or a Client Secret, make sure to use a Credential Handler like in Development Environment the `dotnet user-secrets` and **do not** check in any of them into Source Control!

## 3. Registering the configuration section

You can now use the `.Section<T>()` extension method on `IConfigBuilder` to load configuration information for class or record of the type argument you specify:

```csharp
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
var appBuilder = this.CreateBuilder(args)
.Configure(host => {
host.UseConfiguration(configure: configBuilder =>
configBuilder
.AddEmbeddedSource<App>()
.Section<Auth>("Auth")
...
});
}
```

This binds the `Auth` section to the `Auth` record and makes it available through `IOptions<Auth>` or `IOptionsSnapshot<Auth>`.

## 4. Consuming the options in a service

To access the instantiated representation of the configuration section you registered above, complete with values populated from the `appsettings.json` file, you'll need to add a new constructor parameter for it to one of your application's services.

The configuration section will be injected as an object of type `IOptions<T>`, so add a corresponding parameter for it to the constructor of the service:

```csharp
using Microsoft.Extensions.Options;

public class AuthenticationService : IAuthenticationService
{
public AuthenticationService(IOptions<Auth> settings)
{
var authSettings = settings.Value;
...
}
...
}
```

## Learn more about Configuration in Uno Apps

* [How To: Uno.Extensions.Configuration](xref:Uno.Extensions.Configuration.Overview)
17 changes: 17 additions & 0 deletions reference/ToDo/doc/localize-by-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
uid: Uno.Workshops.ToDo-App.LocalizeByModel
---

# Changing App Localization from Model

## The Home Page

[!code-xaml[](../src/ToDo/Views/HomePage.xaml)]

## Code-Behind of Home Page

[!code-csharp[](../src/ToDo/Views/HomePage.xaml.cs)]

## View Model of Home Page

[!code-csharp[](../src/ToDo/Presentation/HomeViewModel.cs)]
Comment on lines +1 to +17
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think having docs pages here is particularly useful if we are just displaying application code and nothing else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for most of the other new .md files in this directory

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0 you mentioned it to be a possible reference for custom Auth and as its using msal packages from what I saw in the Auth Service, but this sample only has this entry in the Uno Docs
And the ToDo App Blog post I could assume this was coming from is still introducing us to the multi head setup 👀
and its also not even what is shown here 🤷
so the target would have been, to link the appropriate files and add some explaination to each, like what we are seeing and could do with this...

But if we dont want this, feel free to tell what of this you would like to keep, if some or I can also just close this PR and delete the branch.
Could you maybe then check on those other two PR's in this repo, what about those so the stale bot doesn't need to act on them? Thanks 👍

16 changes: 16 additions & 0 deletions reference/ToDo/doc/localize-with-uid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
uid: Uno.Workshops.ToDo-App.LocalizeWithUid
---
# Localize with using x:Uid

## The TaskList Page

[!code-xaml[](../src/ToDo/Views/TaskListPage.xaml)]

## Code-Behind of TaskList Page

[!code-csharp[](../src/ToDo/Views/TaskListPage.xaml.cs)]

## View Model of TaskList Page

[!code-csharp[](../src/ToDo/Presentation/TaskListViewModel.cs)]
13 changes: 13 additions & 0 deletions reference/ToDo/doc/reactive-listfeed-listview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
uid: Uno.Workshops.ToDo-App.Reactive-ListFeeds-FeedViews
---

# Reactive ListFeeds with FeedView

## Task List Page

[!code-xaml[](../src/ToDo/Views/TaskListPage.xaml)]

## Model of Task List Page

[!code-csharp[](../src/ToDo/Presentation/TaskListViewModel.cs)]
Loading
Loading