Skip to content

Commit fed6414

Browse files
committed
UI improvements to the docs sections
1 parent 892999e commit fed6414

18 files changed

+122
-45
lines changed

samples/MvvmSampleUwp/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ResourceDictionary.MergedDictionaries>
1212
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
1313
<ResourceDictionary Source="Controls/InteractiveSample.xaml" />
14+
<ResourceDictionary Source="Controls/DocumentationBlock.xaml" />
1415
</ResourceDictionary.MergedDictionaries>
1516

1617
<!-- MarkdownTextBlock style -->
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using Windows.UI.Xaml;
6+
using Windows.UI.Xaml.Controls;
7+
8+
namespace MvvmSampleUwp.Controls
9+
{
10+
/// <summary>
11+
/// A simple control that acts as a container for a documentation block.
12+
/// </summary>
13+
public sealed class DocumentationBlock : ContentControl
14+
{
15+
/// <summary>
16+
/// Gets or sets the <see cref="string"/> representing the text to display.
17+
/// </summary>
18+
public string Text
19+
{
20+
get => (string)GetValue(TextProperty);
21+
set => SetValue(TextProperty, value);
22+
}
23+
24+
/// <summary>
25+
/// The <see cref="DependencyProperty"/> backing <see cref="Text"/>.
26+
/// </summary>
27+
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
28+
nameof(Text),
29+
typeof(string),
30+
typeof(DocumentationBlock),
31+
new PropertyMetadata(default(string)));
32+
}
33+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
4+
xmlns:local="using:MvvmSampleUwp.Controls">
5+
6+
<!-- Operator button -->
7+
<Style TargetType="local:DocumentationBlock">
8+
<Setter Property="HorizontalAlignment" Value="Stretch" />
9+
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
10+
<Setter Property="VerticalAlignment" Value="Stretch" />
11+
<Setter Property="VerticalContentAlignment" Value="Stretch" />
12+
<Setter Property="IsTabStop" Value="False" />
13+
<Setter Property="Template">
14+
<Setter.Value>
15+
<ControlTemplate TargetType="local:DocumentationBlock">
16+
<Border
17+
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
18+
VerticalAlignment="{TemplateBinding VerticalAlignment}"
19+
Background="{ThemeResource SubtleFillColorTertiaryBrush}"
20+
BorderBrush="{ThemeResource SystemChromeBlackLowColor}"
21+
BorderThickness="1"
22+
CornerRadius="4">
23+
<controls:MarkdownTextBlock
24+
Background="Transparent"
25+
BorderBrush="Transparent"
26+
BorderThickness="0"
27+
Header2FontSize="20"
28+
Header2FontWeight="Bold"
29+
Header2Foreground="{ThemeResource DefaultTextForegroundThemeBrush}"
30+
Header2Margin="0,16,0,16"
31+
Text="{TemplateBinding Text}" />
32+
</Border>
33+
</ControlTemplate>
34+
</Setter.Value>
35+
</Setter>
36+
</Style>
37+
38+
</ResourceDictionary>

samples/MvvmSampleUwp/Controls/InteractiveSample.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<muxc:TabView.Resources>
3030
<x:Double x:Key="TabViewHeaderPadding">0</x:Double>
3131
<x:Double x:Key="TabViewItemHeaderFontSize">14</x:Double>
32+
<StaticResource x:Key="TabViewItemHeaderBackgroundSelected" ResourceKey="ControlFillColorSecondary" />
3233
</muxc:TabView.Resources>
3334
<muxc:TabViewItem
3435
FontWeight="Bold"

samples/MvvmSampleUwp/MvvmSampleUwp.csproj

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@
120120
<Compile Include="App.xaml.cs">
121121
<DependentUpon>App.xaml</DependentUpon>
122122
</Compile>
123-
<Compile Include="Controls\InteractiveSample.cs" />
123+
<Compile Include="Controls\DocumentationBlock.cs" >
124+
<DependentUpon>DocumentationBlock.xaml</DependentUpon>
125+
</Compile>
126+
<Compile Include="Controls\InteractiveSample.cs" >
127+
<DependentUpon>InteractiveSample.xaml</DependentUpon>
128+
</Compile>
124129
<Compile Include="Helpers\TitleBarHelper.cs" />
125130
<Compile Include="Properties\AssemblyInfo.cs" />
126131
<Compile Include="Services\FileService.cs" />
@@ -266,6 +271,10 @@
266271
</PackageReference>
267272
</ItemGroup>
268273
<ItemGroup>
274+
<Page Include="Controls\DocumentationBlock.xaml">
275+
<Generator>MSBuild:Compile</Generator>
276+
<SubType>Designer</SubType>
277+
</Page>
269278
<Page Include="Controls\InteractiveSample.xaml">
270279
<SubType>Designer</SubType>
271280
<Generator>MSBuild:Compile</Generator>

samples/MvvmSampleUwp/Views/AsyncRelayCommandPage.xaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
1010
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1111
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
12-
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
1312
xmlns:viewModels="using:MvvmSample.Core.ViewModels"
1413
NavigationCacheMode="Enabled"
1514
mc:Ignorable="d">
@@ -27,9 +26,9 @@
2726

2827
<ScrollViewer Padding="{StaticResource DocumentationPageContentPadding}" CanContentRenderOutsideBounds="True">
2928
<StackPanel Spacing="16">
30-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('AsyncRelayCommand and AsyncRelayCommand&lt;T>'), Mode=OneWay}" />
31-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('How they work'), Mode=OneWay}" />
32-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Working with asynchronous commands'), Mode=OneWay}" />
29+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('AsyncRelayCommand and AsyncRelayCommand&lt;T>'), Mode=OneWay}" />
30+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('How they work'), Mode=OneWay}" />
31+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Working with asynchronous commands'), Mode=OneWay}" />
3332

3433
<controls:InteractiveSample xml:space="preserve">
3534
<controls:InteractiveSample.Content>

samples/MvvmSampleUwp/Views/BuildingTheUIPage.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
x:Class="MvvmSampleUwp.Views.BuildingTheUIPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:MvvmSampleUwp.Controls"
56
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
89
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
1010
xmlns:viewModels="using:MvvmSample.Core.ViewModels"
1111
NavigationCacheMode="Enabled"
1212
mc:Ignorable="d">
@@ -21,12 +21,12 @@
2121

2222
<ScrollViewer Padding="{StaticResource DocumentationPageContentPadding}" CanContentRenderOutsideBounds="True">
2323
<StackPanel Spacing="16">
24-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Building the UI'), Mode=OneWay}" />
25-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Subreddit selector:'), Mode=OneWay}" />
26-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Refresh button:'), Mode=OneWay}" />
27-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Posts list:'), Mode=OneWay}" />
28-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Loading bar:'), Mode=OneWay}" />
29-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Good to go! 🚀'), Mode=OneWay}" />
24+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Building the UI'), Mode=OneWay}" />
25+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Subreddit selector:'), Mode=OneWay}" />
26+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Refresh button:'), Mode=OneWay}" />
27+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Posts list:'), Mode=OneWay}" />
28+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Loading bar:'), Mode=OneWay}" />
29+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Good to go! 🚀'), Mode=OneWay}" />
3030
</StackPanel>
3131
</ScrollViewer>
3232
</Page>

samples/MvvmSampleUwp/Views/IntroductionPage.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
x:Class="MvvmSampleUwp.Views.IntroductionPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:MvvmSampleUwp.Controls"
56
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
89
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
1010
xmlns:viewModels="using:MvvmSample.Core.ViewModels"
1111
NavigationCacheMode="Enabled"
1212
mc:Ignorable="d">
@@ -21,8 +21,8 @@
2121

2222
<ScrollViewer Padding="{StaticResource DocumentationPageContentPadding}" CanContentRenderOutsideBounds="True">
2323
<StackPanel Spacing="16">
24-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Introduction to the MVVM package'), Mode=OneWay}" />
25-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('When should I use this package?'), Mode=OneWay}" />
24+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Introduction to the MVVM package'), Mode=OneWay}" />
25+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('When should I use this package?'), Mode=OneWay}" />
2626
</StackPanel>
2727
</ScrollViewer>
2828
</Page>

samples/MvvmSampleUwp/Views/IocPage.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
x:Class="MvvmSampleUwp.Views.IocPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:MvvmSampleUwp.Controls"
56
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
89
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
1010
xmlns:viewModels="using:MvvmSample.Core.ViewModels"
1111
NavigationCacheMode="Enabled"
1212
mc:Ignorable="d">
@@ -21,9 +21,9 @@
2121

2222
<ScrollViewer Padding="{StaticResource DocumentationPageContentPadding}" CanContentRenderOutsideBounds="True">
2323
<StackPanel Spacing="16">
24-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Ioc (Inversion of control)'), Mode=OneWay}" />
25-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Configure and resolve services'), Mode=OneWay}" />
26-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Constructor injection'), Mode=OneWay}" />
24+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Ioc (Inversion of control)'), Mode=OneWay}" />
25+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Configure and resolve services'), Mode=OneWay}" />
26+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Constructor injection'), Mode=OneWay}" />
2727
</StackPanel>
2828
</ScrollViewer>
2929
</Page>

samples/MvvmSampleUwp/Views/MessengerPage.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
x:Class="MvvmSampleUwp.Views.MessengerPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:MvvmSampleUwp.Controls"
56
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
89
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9-
xmlns:toolkit="using:Microsoft.Toolkit.Uwp.UI.Controls"
1010
xmlns:viewModels="using:MvvmSample.Core.ViewModels"
1111
NavigationCacheMode="Enabled"
1212
mc:Ignorable="d">
@@ -21,8 +21,8 @@
2121

2222
<ScrollViewer Padding="{StaticResource DocumentationPageContentPadding}" CanContentRenderOutsideBounds="True">
2323
<StackPanel Spacing="16">
24-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('Messenger'), Mode=OneWay}" />
25-
<toolkit:MarkdownTextBlock Text="{x:Bind ViewModel.GetParagraph('How it works'), Mode=OneWay}" />
24+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('Messenger'), Mode=OneWay}" />
25+
<controls:DocumentationBlock Text="{x:Bind ViewModel.GetParagraph('How it works'), Mode=OneWay}" />
2626
</StackPanel>
2727
</ScrollViewer>
2828
</Page>

0 commit comments

Comments
 (0)