Skip to content

Commit 7c1dad1

Browse files
committed
feat(Tutorial): Add Sample App created while XamlNavigation with NavigationView Tutorial
1 parent f84888b commit 7c1dad1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1617
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"solution": {
3+
"path": "DevTKSS.Uno.Samples.sln",
4+
"projects": [
5+
"DevTKSS.Uno.Samples.MvuxGallery\\DevTKSS.Uno.Samples.MvuxGallery.csproj"
6+
]
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"solution": {
3+
"path": "DevTKSS.Uno.Samples.sln",
4+
"projects": [
5+
"DevTKSS.Uno.XamlNavigationApp-1\\DevTKSS.Uno.XamlNavigationApp.csproj"
6+
]
7+
}
8+
}

src/DevTKSS.Uno.Samples.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTKSS.Uno.Samples.MvuxGallery", "DevTKSS.Uno.Samples.MvuxGallery\DevTKSS.Uno.Samples.MvuxGallery.csproj", "{541B1686-7761-9408-94BD-1E25D46AAC83}"
1717
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTKSS.Uno.XamlNavigationApp", "DevTKSS.Uno.XamlNavigationApp-1\DevTKSS.Uno.XamlNavigationApp.csproj", "{AE75474D-B5FC-3152-7897-AB178447428A}"
19+
EndProject
1820
Global
1921
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2022
Debug|Any CPU = Debug|Any CPU
@@ -25,6 +27,10 @@ Global
2527
{541B1686-7761-9408-94BD-1E25D46AAC83}.Debug|Any CPU.Build.0 = Debug|Any CPU
2628
{541B1686-7761-9408-94BD-1E25D46AAC83}.Release|Any CPU.ActiveCfg = Release|Any CPU
2729
{541B1686-7761-9408-94BD-1E25D46AAC83}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{AE75474D-B5FC-3152-7897-AB178447428A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{AE75474D-B5FC-3152-7897-AB178447428A}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{AE75474D-B5FC-3152-7897-AB178447428A}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{AE75474D-B5FC-3152-7897-AB178447428A}.Release|Any CPU.Build.0 = Release|Any CPU
2834
EndGlobalSection
2935
GlobalSection(SolutionProperties) = preSolution
3036
HideSolutionNode = FALSE
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Application x:Class="DevTKSS.Uno.XamlNavigationApp.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:utum="using:Uno.Toolkit.UI.Material">
5+
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<!-- Load WinUI resources -->
10+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
11+
<utum:MaterialToolkitTheme
12+
ColorOverrideSource="ms-appx:///Styles/ColorPaletteOverride.xaml">
13+
<!-- NOTE: You can override the default Roboto font by providing your font assets here. -->
14+
<!-- <utum:MaterialToolkitTheme.FontOverrideDictionary>
15+
<ResourceDictionary>
16+
<FontFamily x:Key="MaterialLightFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Light.ttf#Roboto</FontFamily>
17+
<FontFamily x:Key="MaterialMediumFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf#Roboto</FontFamily>
18+
<FontFamily x:Key="MaterialRegularFontFamily">ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf#Roboto</FontFamily>
19+
</ResourceDictionary>
20+
</utum:MaterialToolkitTheme.FontOverrideDictionary> -->
21+
</utum:MaterialToolkitTheme>
22+
</ResourceDictionary.MergedDictionaries>
23+
24+
<!-- Add resources here -->
25+
26+
</ResourceDictionary>
27+
</Application.Resources>
28+
29+
</Application>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using Uno.Resizetizer;
2+
3+
namespace DevTKSS.Uno.XamlNavigationApp;
4+
public partial class App : Application
5+
{
6+
/// <summary>
7+
/// Initializes the singleton application object. This is the first line of authored code
8+
/// executed, and as such is the logical equivalent of main() or WinMain().
9+
/// </summary>
10+
public App()
11+
{
12+
this.InitializeComponent();
13+
}
14+
15+
protected Window? MainWindow { get; private set; }
16+
protected IHost? Host { get; private set; }
17+
18+
protected async override void OnLaunched(LaunchActivatedEventArgs args)
19+
{
20+
var builder = this.CreateBuilder(args)
21+
// Add navigation support for toolkit controls such as TabBar and NavigationView
22+
.UseToolkitNavigation()
23+
.Configure(host => host
24+
#if DEBUG
25+
// Switch to Development environment when running in DEBUG
26+
.UseEnvironment(Environments.Development)
27+
#endif
28+
.UseLogging(configure: (context, logBuilder) =>
29+
{
30+
// Configure log levels for different categories of logging
31+
logBuilder
32+
.SetMinimumLevel(
33+
context.HostingEnvironment.IsDevelopment() ?
34+
LogLevel.Information :
35+
LogLevel.Warning)
36+
37+
// Default filters for core Uno Platform namespaces
38+
.CoreLogLevel(LogLevel.Warning);
39+
40+
// Uno Platform namespace filter groups
41+
// Uncomment individual methods to see more detailed logging
42+
//// Generic Xaml events
43+
//logBuilder.XamlLogLevel(LogLevel.Debug);
44+
//// Layout specific messages
45+
//logBuilder.XamlLayoutLogLevel(LogLevel.Debug);
46+
//// Storage messages
47+
//logBuilder.StorageLogLevel(LogLevel.Debug);
48+
//// Binding related messages
49+
//logBuilder.XamlBindingLogLevel(LogLevel.Debug);
50+
//// Binder memory references tracking
51+
//logBuilder.BinderMemoryReferenceLogLevel(LogLevel.Debug);
52+
//// DevServer and HotReload related
53+
//logBuilder.HotReloadCoreLogLevel(LogLevel.Information);
54+
//// Debug JS interop
55+
//logBuilder.WebAssemblyLogLevel(LogLevel.Debug);
56+
57+
}, enableUnoLogging: true)
58+
.UseConfiguration(configure: configBuilder =>
59+
configBuilder
60+
.EmbeddedSource<App>()
61+
.Section<AppConfig>()
62+
)
63+
// Enable localization (see appsettings.json for supported languages)
64+
.UseLocalization()
65+
.ConfigureServices((context, services) =>
66+
{
67+
// TODO: Register your services
68+
//services.AddSingleton<IMyService, MyService>();
69+
})
70+
.UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes)
71+
);
72+
MainWindow = builder.Window;
73+
74+
#if DEBUG
75+
MainWindow.UseStudio();
76+
#endif
77+
MainWindow.SetWindowIcon();
78+
79+
Host = await builder.NavigateAsync<Shell>();
80+
}
81+
82+
private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
83+
{
84+
views.Register(
85+
new ViewMap(ViewModel: typeof(ShellModel)),
86+
new ViewMap<MainPage, MainModel>(),
87+
new ViewMap<DashboardPage, DashboardModel>(),
88+
new ViewMap<SecondPage, SecondModel>()
89+
);
90+
91+
routes.Register(
92+
new RouteMap("", View: views.FindByViewModel<ShellModel>(),
93+
Nested:
94+
[
95+
new ("Main", View: views.FindByViewModel<MainModel>(), IsDefault:true,
96+
Nested:
97+
[
98+
new("Dashboard", View: views.FindByViewModel<DashboardModel>(),IsDefault:true),
99+
new ("Second", View: views.FindByViewModel<SecondModel>())
100+
])
101+
]
102+
)
103+
);
104+
}
105+
}
Lines changed: 42 additions & 0 deletions
Loading
Lines changed: 137 additions & 0 deletions
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Shared Assets
2+
3+
See documentation about assets here: https://github.com/unoplatform/uno/blob/master/doc/articles/features/working-with-assets.md
4+
5+
## Here is a cheat sheet
6+
7+
1. Add the image file to the `Assets` directory of a shared project.
8+
2. Set the build action to `Content`.
9+
3. (Recommended) Provide an asset for various scales/dpi
10+
11+
### Examples
12+
13+
```text
14+
\Assets\Images\logo.scale-100.png
15+
\Assets\Images\logo.scale-200.png
16+
\Assets\Images\logo.scale-400.png
17+
18+
\Assets\Images\scale-100\logo.png
19+
\Assets\Images\scale-200\logo.png
20+
\Assets\Images\scale-400\logo.png
21+
```
22+
23+
### Table of scales
24+
25+
| Scale | WinUI | iOS | Android |
26+
|-------|:-----------:|:---------------:|:-------:|
27+
| `100` | scale-100 | @1x | mdpi |
28+
| `125` | scale-125 | N/A | N/A |
29+
| `150` | scale-150 | N/A | hdpi |
30+
| `200` | scale-200 | @2x | xhdpi |
31+
| `300` | scale-300 | @3x | xxhdpi |
32+
| `400` | scale-400 | N/A | xxxhdpi |

0 commit comments

Comments
 (0)