Skip to content

Commit 6e1405c

Browse files
committed
fix: Listboard Header Styling fixed by using Parent Binding
chore: add Sample Expander to bottom of ListboardPage BUG: Not able to fetch Data from CodeSampleService
1 parent 9fbaaad commit 6e1405c

File tree

5 files changed

+44
-16
lines changed

5 files changed

+44
-16
lines changed

src/DevTKSS.Uno.Samples.MvuxGallery/Presentation/ViewModels/DashboardModel.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,17 @@ namespace DevTKSS.Uno.Samples.MvuxGallery.Presentation.ViewModels;
77
public partial record DashboardModel
88
{
99
#region Services
10-
private readonly INavigator _navigator;
11-
private readonly ILocalizationService _localizationService;
1210
private readonly IStringLocalizer _stringLocalizer;
1311
private readonly IGalleryImageService _galleryImageService;
1412
private readonly IStorage _storage;
1513
private readonly ILogger _logger;
1614
#endregion
1715
public DashboardModel(
18-
INavigator navigator,
19-
ILocalizationService localizationService,
2016
IStringLocalizer stringLocalizer,
2117
IGalleryImageService galleryImageService,
2218
IStorage storage,
2319
ILogger<DashboardModel> logger)
2420
{
25-
this._navigator = navigator;
26-
this._localizationService = localizationService;
2721
this._stringLocalizer = stringLocalizer;
2822
this._galleryImageService = galleryImageService;
2923
this._storage = storage;

src/DevTKSS.Uno.Samples.MvuxGallery/Presentation/ViewModels/ListboardModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ public partial record ListboardModel
2727
/// </summary>
2828
/// <param name="stringLocalizer">The string localizer service.</param>
2929
/// <param name="galleryImageService">The gallery image service.</param>
30-
/// <param name="codeSampleService">The code sample service.</param>
30+
/// <param name="serviceProvider">The serviceProvider, to fetch the code sample service as NamedService from with correct configuration.</param>
3131
public ListboardModel(
3232
IStringLocalizer stringLocalizer,
3333
IGalleryImageService galleryImageService,
34-
ICodeSampleService codeSampleService)
34+
IServiceProvider serviceProvider)
3535
{
3636
this._stringLocalizer = stringLocalizer;
3737
this._galleryImageService = galleryImageService;
38-
this._codeSampleService = codeSampleService;
38+
this._codeSampleService = serviceProvider.GetRequiredNamedService<ICodeSampleService>("ListboardSampleService");
3939
}
4040

4141
/// <summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</mvux:FeedView>
5656
<Expander Grid.Row="2"
5757
ExpandDirection="Down"
58-
MaxHeight="{x:Bind DevideByTwo(DashboardGrid.Height), Mode=OneWay}">
58+
MaxHeight="300">
5959

6060
<Expander.Header>
6161
<utu:TabBar VerticalAlignment="Bottom"

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

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
<Grid.RowDefinitions>
1919
<RowDefinition Height="Auto"/>
2020
<RowDefinition Height="*"/>
21+
<RowDefinition Height="Auto"
22+
MaxHeight="300" />
2123
</Grid.RowDefinitions>
2224

23-
<!--<TextBlock TextAlignment="Center"
25+
<TextBlock Grid.Row="0"
26+
TextAlignment="Center"
2427
VerticalAlignment="Center"
2528
Style="{StaticResource HeadlineMedium}"
2629
Text="{Binding ListboardTitle}"
27-
Foreground="{ThemeResource OnSecondaryContainerBrush}"/>-->
30+
Foreground="{ThemeResource OnSecondaryContainerBrush}"/>
2831

2932
<mvux:FeedView x:Name="LeftFeedView"
3033
Grid.Row="1"
@@ -37,7 +40,7 @@
3740
Footer="{Binding CurrentCodeSample}"
3841
FooterTemplate="{StaticResource CodeSampleTemplate}"
3942
HeaderTemplate="{StaticResource ViewHeaderTemplate}"
40-
Header="{Binding ViewHeaderContent}"
43+
Header="{Binding Parent.ViewHeaderContent}"
4144
AllowDrop="False"
4245
CanDrag="False"
4346
CanReorderItems="False"
@@ -47,5 +50,33 @@
4750
</DataTemplate>
4851
</mvux:FeedView.ValueTemplate>
4952
</mvux:FeedView>
53+
<Expander Grid.Row="2"
54+
ExpandDirection="Down"
55+
MaxHeight="300">
56+
57+
<Expander.Header>
58+
<utu:TabBar VerticalAlignment="Bottom"
59+
ItemsSource="{Binding CodeSampleOptions}"
60+
SelectedItem="{Binding SelectedOption, Mode=TwoWay}">
61+
<utu:TabBar.ItemTemplate>
62+
<DataTemplate>
63+
<utu:TabBarItem Content="{Binding}"
64+
Command="{Binding SwitchCodeSampleAsync}"
65+
CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content}"
66+
Style="{StaticResource MaterialTopTabBarItemStyle}"
67+
Icon="Home" />
68+
</DataTemplate>
69+
</utu:TabBar.ItemTemplate>
70+
</utu:TabBar>
71+
</Expander.Header>
72+
<Expander.Content>
73+
<ScrollViewer>
74+
<TextBlock x:Name="CodeSampleBlock"
75+
Text="{Binding CurrentCodeSample}"
76+
TextWrapping="WrapWholeWords" />
77+
</ScrollViewer>
78+
</Expander.Content>
79+
80+
</Expander>
5081
</Grid>
5182
</Page>

src/DevTKSS.Uno.Samples.MvuxGallery/Styles/Generic.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,18 @@
7171
Style="{ThemeResource TitleMedium}"
7272
Margin="16,14,16,0"
7373
Foreground="{ThemeResource OnSurfaceInverseBrush}"
74-
VerticalAlignment="Stretch"
74+
VerticalAlignment="Center"
7575
HorizontalAlignment="Center"
7676
TextAlignment="Center"
7777
Grid.Column="1"
7878
TextWrapping="WrapWholeWords"/>
79-
<AppBarButton Command="{utu:AncestorBinding AncestorType=mvux:FeedView, Path=Refresh}"
79+
<AppBarButton Style="{StaticResource FilledButtonStyle}"
80+
Command="{utu:AncestorBinding AncestorType=mvux:FeedView, Path=Refresh}"
8081
HorizontalAlignment="Center"
8182
VerticalAlignment="Stretch"
82-
Grid.Column="2" Icon="Refresh"/>
83+
Grid.Column="2">
84+
<SymbolIcon Symbol="Refresh" />
85+
</AppBarButton>
8386
</Grid>
8487
</DataTemplate>
8588

0 commit comments

Comments
 (0)