Skip to content

Commit 1cf7170

Browse files
committed
chore: Add codeblock to XamlNavigation until its DocFx generated and replaced by code-csharp block
1 parent 3780b65 commit 1cf7170

File tree

3 files changed

+70
-7
lines changed

3 files changed

+70
-7
lines changed

cSpell.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
"Listboard",
99
"Mvux",
1010
"appsettings",
11-
"sampledata"
11+
"sampledata",
12+
"Resizetizer"
13+
],
14+
"dictionaries": [
15+
"csharp",
16+
"companies"
1217
],
1318
"ignoreWords": [],
1419
"ignorePaths": [

doc/articles/MvuxGallery/How-To-XamlNavigation.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,70 @@ Grundlegend enthält es die gleichen Bausteine wie man es von einer Navigation m
1818
1919
## Voraussetzungen erfüllen
2020
21+
Bevor es los geht, prüft bitte mit `Uno.Check` ob eure Entwicklungs-Umgebung startklar ist. Hierzu habe ich euch eine kurze Link Sammlung zu allen dahingehenden Dokumentations-Seiten im Bereich [Getting Started](../getting-started.md) erstellt.
22+
2123
Solltet ihr schon eine existierende Uno Anwendung haben, prüft einfach mal in der .csproj Datei, ob ihr in der `UnoFeatures` Sammlung die Elemente `Hosting` und `Navigation` habt und fügt diese hinzu, wenn das nicht bereits der Fall sein sollte.
2224
2325
Des weiteren benötigt eure App.xaml.cs Datei folgende Elemente:
2426
25-
![code-csharp[](../../../src/DevTKSS.Uno.Samples.MvuxGallery/App.xaml.cs?highlight=L19-L23,L96,L110,L113-L115,L124-L130)]
27+
<!--![code-csharp[](../../../src/DevTKSS.Uno.Samples.MvuxGallery/App.xaml.cs?highlight=L19-L23,L96,L110,L113-L115,L124-L130)] TODO: uncomment as soon as the docs are DocFx generated-->
28+
```diff
29+
using Uno.Resizetizer;
30+
31+
namespace DevTKSS.Uno.Samples.MvuxGallery;
32+
public partial class App : Application
33+
{
34+
/// <summary>
35+
/// Initializes the singleton application object. This is the first line of authored code
36+
/// executed, and as such is the logical equivalent of main() or WinMain().
37+
/// </summary>
38+
public App()
39+
{
40+
this.InitializeComponent();
41+
}
42+
43+
+ protected Window? MainWindow { get; private set; }
44+
protected IHost? Host { get; private set; }
45+
46+
+ protected async override void OnLaunched(LaunchActivatedEventArgs args)
47+
+ {
48+
+ var builder = this.CreateBuilder(args)
49+
+ // Add navigation support for toolkit controls such as TabBar and NavigationView
50+
+ .UseToolkitNavigation()
51+
+ .Configure(host => host
52+
+ .UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes)
53+
+ );
54+
MainWindow = builder.Window;
55+
56+
#if DEBUG
57+
MainWindow.UseStudio();
58+
#endif
59+
MainWindow.SetWindowIcon();
60+
61+
+ Host = await builder.NavigateAsync<Shell>();
62+
}
63+
+
64+
+ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
65+
+ {
66+
+ views.Register(
67+
+ new ViewMap(ViewModel: typeof(ShellModel)),
68+
+ new ViewMap<MainPage, MainModel>(),
69+
+ new ViewMap<SecondPage, SecondModel>()
70+
+ );
71+
+
72+
+ routes.Register(
73+
+ new RouteMap("", View: views.FindByViewModel<ShellModel>(),
74+
+ Nested:
75+
+ [
76+
+ new ("Main", View: views.FindByViewModel<MainModel>(), IsDefault:true),
77+
+ new ("Second", View: views.FindByViewModel<SecondModel>()),
78+
+ ]
79+
+ )
80+
+ );
81+
+ }
82+
+ }
83+
84+
```
2685

2786
Den Namespace, den wir in einer Xaml-basierten Navigation in einer Uno Anwendung benötigen, ist `Uno.Extensions.Navigation.UI`, meist mit dem xmlns Namespace Identifikator `xmlns:uen=` eurer Seite dann vorzufinden.
2887

src/DevTKSS.Uno.Samples.MvuxGallery/App.xaml.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using System.Text.Json;
2-
using Microsoft.Extensions.Configuration;
3-
using Microsoft.Extensions.DependencyInjection;
42
using Uno.Resizetizer;
53

64
namespace DevTKSS.Uno.Samples.MvuxGallery;
5+
76
public partial class App : Application
87
{
98
/// <summary>
@@ -81,10 +80,10 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
8180
.AddSingleton<IGalleryImageService, GalleryImageService>()
8281

8382
.AddSingleton<ICodeSampleService<MainSampleOptions>, CodeSampleService<MainSampleOptions>>()
84-
.AddSingleton<ICodeSampleService<ListboardSampleOptions>,CodeSampleService<ListboardSampleOptions>>()
83+
.AddSingleton<ICodeSampleService<ListboardSampleOptions>, CodeSampleService<ListboardSampleOptions>>()
8584
.AddSingleton<ICodeSampleService<SimpleCardsSampleOptions>, CodeSampleService<SimpleCardsSampleOptions>>()
8685
.AddSingleton<ICodeSampleService<CounterSampleOptions>, CodeSampleService<CounterSampleOptions>>()
87-
//.AddSingleton<ICodeSampleService<DashboardSampleOptions>, CodeSampleService<DashboardSampleOptions>>()
86+
//.AddSingleton<ICodeSampleService<DashboardSampleOptions>, CodeSampleService<DashboardSampleOptions>>()
8887
)
8988
.UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes)
9089
.UseSerialization((context, services) =>
@@ -106,7 +105,7 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
106105
)
107106
);
108107
MainWindow = builder.Window;
109-
108+
110109
#if DEBUG
111110
MainWindow.UseStudio();
112111
#endif

0 commit comments

Comments
 (0)