Skip to content

Commit 090d371

Browse files
authored
feat(SimpleListPage): Add Sample Page with only ListView no FeedView used
This new Sample page is utilizing a FeedView-less ItemsSource bound ListView in an Mvux Uno App
2 parents 0a58c96 + dc18a3f commit 090d371

File tree

8 files changed

+97
-3
lines changed

8 files changed

+97
-3
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
122122
new ViewMap<CounterPage, CounterModel>(),
123123
new ViewMap<DashboardPage, DashboardModel>(),
124124
new ViewMap<ListboardPage, ListboardModel>(),
125-
new ViewMap<SimpleCardsPage, SimpleCardsModel>()
125+
new ViewMap<SimpleCardsPage, SimpleCardsModel>(),
126+
new ViewMap<SimpleListPage, SimpleListModel>()
126127
);
127128

128129
routes.Register(
@@ -136,6 +137,7 @@ private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
136137
new ("Listboard", View: views.FindByViewModel<ListboardModel>()),
137138
new ("Counter", View: views.FindByViewModel<CounterModel>()),
138139
new ("SimpleCards", View: views.FindByViewModel<SimpleCardsModel>()),
140+
new ("SimpleList", View: views.FindByViewModel<SimpleListModel>()),
139141
]
140142
),
141143

src/DevTKSS.Uno.Samples.MvuxGallery/DevTKSS.Uno.Samples.MvuxGallery.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,15 @@
5656
<Resource Include="Assets\Samples\*" CopyToOutputDirectory="PreserveNewest" />
5757
<UnoSplashScreen Include="Assets\SplashScreens\*" />
5858
</ItemGroup>
59+
<ItemGroup>
60+
<Compile Update="Presentation\Views\SimpleListPage.xaml.cs">
61+
<DependentUpon>SimpleListPage.xaml</DependentUpon>
62+
</Compile>
63+
</ItemGroup>
64+
<ItemGroup>
65+
<Page Update="Presentation\Views\SimpleListPage.xaml">
66+
<Generator>MSBuild:Compile</Generator>
67+
</Page>
68+
</ItemGroup>
5969

6070
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Uno.Extensions.Reactive.Commands;
2+
3+
namespace DevTKSS.Uno.Samples.MvuxGallery.Presentation.ViewModels;
4+
5+
public partial record SimpleListModel
6+
{
7+
#region Services
8+
private readonly IStringLocalizer _stringLocalizer;
9+
private readonly IGalleryImageService _galleryImageService;
10+
11+
#endregion
12+
public SimpleListModel(
13+
IStringLocalizer stringLocalizer,
14+
IGalleryImageService galleryImageService
15+
)
16+
{
17+
this._stringLocalizer = stringLocalizer;
18+
this._galleryImageService = galleryImageService;
19+
}
20+
21+
public IListFeed<GalleryImageModel> GalleryImagesWithResw => ListFeed.Async(_galleryImageService.GetGalleryImagesWithReswAsync);
22+
23+
24+
public IState<string> SimpleListTitle => State<string>.Value(this, () => _stringLocalizer["SimpleListTitle"]);
25+
26+
}
27+
28+
29+

src/DevTKSS.Uno.Samples.MvuxGallery/Presentation/Views/MainPage.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
<FontIcon x:Name="TaskView" Glyph="&#xEB91;" />
5656
</NavigationViewItem.Icon>
5757
</NavigationViewItem>
58+
<NavigationViewItem Content="Simple List"
59+
uen:Region.Name="SimpleList"
60+
Icon="List" />
5861
</NavigationView.MenuItems>
5962

6063
<NavigationView.Content>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Page
2+
x:Class="DevTKSS.Uno.Samples.MvuxGallery.Presentation.Views.SimpleListPage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:DevTKSS.Uno.Samples.MvuxGallery.Presentation.Views"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
Background="{ThemeResource BackgroundBrush}">
10+
11+
<ListView ItemsSource="{Binding GalleryImagesWithResw}"
12+
ItemTemplate="{StaticResource GalleryImageOverlayTemplate}"
13+
SelectionMode="Single">
14+
</ListView>
15+
16+
</Page>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Microsoft.UI.Xaml;
7+
using Microsoft.UI.Xaml.Controls;
8+
using Microsoft.UI.Xaml.Controls.Primitives;
9+
using Microsoft.UI.Xaml.Data;
10+
using Microsoft.UI.Xaml.Input;
11+
using Microsoft.UI.Xaml.Media;
12+
using Microsoft.UI.Xaml.Navigation;
13+
using Windows.Foundation;
14+
using Windows.Foundation.Collections;
15+
16+
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
17+
18+
namespace DevTKSS.Uno.Samples.MvuxGallery.Presentation.Views;
19+
/// <summary>
20+
/// An empty page that can be used on its own or navigated to within a Frame.
21+
/// </summary>
22+
public sealed partial class SimpleListPage : Page
23+
{
24+
public SimpleListPage()
25+
{
26+
this.InitializeComponent();
27+
}
28+
}

src/DevTKSS.Uno.Samples.MvuxGallery/Strings/de/Resources.resw

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,12 @@
151151
<value>Ein lebhafter Freigeist, der mit seinen lustigen Sprüngen und Hüpfern für pure Lebensfreude sorgt.</value>
152152
</data>
153153
<data name="WelcomeGreeting" xml:space="preserve">
154-
<value>Willkommen zu meiner Uno App!</value>
154+
<value>Willkommen zu meiner MvuxGallery App!</value>
155155
</data>
156156
<data name="SimpleCardsTitle" xml:space="preserve">
157157
<value>Definiere die Cards Elemente direkt im XAML der Seite</value>
158158
</data>
159+
<data name="SimpleListTitle" xml:space="preserve">
160+
<value>Hier gibt's nur eine ListView ohne FeedView zu sehen</value>
161+
</data>
159162
</root>

src/DevTKSS.Uno.Samples.MvuxGallery/Strings/en/Resources.resw

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,12 @@
151151
<value>A lively free spirit who bounces around spreading cheer and fun.</value>
152152
</data>
153153
<data name="WelcomeGreeting" xml:space="preserve">
154-
<value>Welcome to my first Uno HotDesign App!</value>
154+
<value>Welcome to the MvuxGallery App!</value>
155155
</data>
156156
<data name="SimpleCardsTitle" xml:space="preserve">
157157
<value>Define the Cards Elements direkty in the XAML of your Page</value>
158158
</data>
159+
<data name="SimpleListTitle" xml:space="preserve">
160+
<value>The only one you can see here is a ListView without a FeedView.</value>
161+
</data>
159162
</root>

0 commit comments

Comments
 (0)