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
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
2 changes: 1 addition & 1 deletion reference/Commerce/src/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/Counter/CSharp-MVUX/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/Counter/CSharp-MVVM/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
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.
2 changes: 1 addition & 1 deletion reference/Counter/XAML-MVUX/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/Counter/XAML-MVVM/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/SimpleCalc/CSharp-MVUX/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/SimpleCalc/CSharp-MVVM/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/SimpleCalc/XAML-MVUX/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
2 changes: 1 addition & 1 deletion reference/SimpleCalc/XAML-MVVM/global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
"msbuild-sdks": {
"Uno.Sdk": "6.0.67"
"Uno.Sdk": "6.0.146"
},
"sdk": {
"allowPrerelease": false
Expand Down
30 changes: 30 additions & 0 deletions reference/ToDo/Overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
uid: Uno.Workshops.ToDo-App.Overview
---
# ToDo App

<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 is a beautifully designed sample app 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-->

* [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-ListFeed-FeedView)

## 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-xaml[](../src/ToDo/Views/TaskListPage.xaml.cs)]

## View Model of Task Page

[!code-csharp[](../src/ToDo/Presentation/TaskListViewModel.cs)]
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)]
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-ListFeed-FeedView
---

# 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)]
38 changes: 38 additions & 0 deletions reference/ToDo/doc/serialize-json-for-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
uid: Uno.Workshops.ToDo-App.SerializeJsonForOptions
---
# Serialize Records loaded by Options

## Immutability with IOptions

<!-- TODO: Add Guide explaining how this is done in ToDo App correctly with examples - DevTKSS assigning -->

### Not like this

This full immutable Record definition does not work in case we want to use it to be serialized from `appsettings.json` and load it via Options, even with all parameters marked as Nullable like this:

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

## Possible Errors

It would mark this part in the App HostBuilder:

[!code-csharp[](../src/ToDo/App.xaml.cs#L59-L70?highlight=65)]

With one of this Error Messages:

```plaintext
IOptions<T> requires the type T to have a parameterless constructor so that it can be instantiated and populated with values from the configuration source. A fully immutable record does not have a parameterless constructor because all properties must be initialized in the constructor.
```

```plaintext
IOptions<T> uses setters to populate the properties with values. In a fully immutable record, the properties are read-only (get-only), meaning they cannot be modified after initialization.
```

Which would both result in an `System.InvalidOperationException` not allowing us to even build our Application.

## Related Pages

* [How To: Uno.Extensions.Serialization](https://aka.platform.uno/docs/articles/external/uno.extensions/doc/Learn/Serialization/HowTo-Serialization.html)
8 changes: 8 additions & 0 deletions reference/ToDo/doc/theme-switching-with-theme-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
uid: Uno.Workshops.ToDo-App.Theme-Switching-by-ThemeService
---
# Theme Switching with Theme Service

## The View Model

[!code-csharp[](../src/ToDo/Presentation/SettingsViewModel.cs)]
2 changes: 1 addition & 1 deletion reference/ToDo/src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
See https://aka.platform.uno/using-uno-sdk#implicit-packages for more information regarding the Implicit Packages.
-->
<ItemGroup>
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.7.0" />
</ItemGroup>
</Project>
Loading