Skip to content

A Swiss Army knife for developers.

UI tweaks

Etienne Baudoux96ebd484debb
diff --git a/src/dev/impl/DevTools.Impl/DevTools.Impl.csproj b/src/dev/impl/DevTools.Impl/DevTools.Impl.csproj
index e360add3e..0a920cd2d 100644
--- a/src/dev/impl/DevTools.Impl/DevTools.Impl.csproj
+++ b/src/dev/impl/DevTools.Impl/DevTools.Impl.csproj
@@ -82,7 +82,11 @@
<Compile Include="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\Settings\SettingsToolPage.xaml.cs">
+ <DependentUpon>SettingsToolPage.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\Settings\SettingsToolProvider.cs" />
+ <Compile Include="Views\Settings\SettingsToolViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\startup\DevTools.Startup\Assets\Logo\Square44x44Logo.scale-200.png">
@@ -119,6 +123,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\Settings\SettingsToolPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml b/src/dev/impl/DevTools.Impl/Views/MainPage.xaml
index e36a627e4..71419e5a7 100644
--- a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml
+++ b/src/dev/impl/DevTools.Impl/Views/MainPage.xaml
@@ -26,6 +26,7 @@
<!--This top margin is the height of the custom TitleBar-->
<Thickness x:Key="NavigationViewContentMargin">0,48,0,0</Thickness>
+ <Thickness x:Key="NavigationViewHeaderMargin">16,42,0,0</Thickness>
</Page.Resources>
<Grid Background="Transparent">
@@ -140,7 +141,7 @@
ExpandedModeThresholdWidth="550"
PaneDisplayMode="Auto"
IsTabStop="False"
- AlwaysShowHeader="{x:Bind ViewModel.IsInCompactOverlayMode, Mode=OneWay}"
+ AlwaysShowHeader="{x:Bind ViewModel.IsInCompactOverlayMode, Mode=OneWay, Converter={StaticResource InvertedBooleanConverter}}"
IsPaneVisible="{x:Bind ViewModel.IsInCompactOverlayMode, Mode=OneWay, Converter={StaticResource InvertedBooleanConverter}}"
Header="{x:Bind ViewModel.SelectedMenuItem.ToolProvider.DisplayName, Mode=OneWay}"
MenuItemsSource="{x:Bind ViewModel.ToolsMenuItems}"
@@ -150,7 +151,8 @@
<muxc:NavigationView.MenuItemTemplate>
<DataTemplate x:DataType="models:MatchedToolProviderViewData">
<muxc:NavigationViewItem
- Icon="{x:Bind Icon.Result, Mode=OneWay}">
+ Icon="{x:Bind Icon.Result, Mode=OneWay}"
+ Margin="12,0,12,0">
<muxc:NavigationViewItem.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem
@@ -208,7 +210,14 @@
</AutoSuggestBox>
</muxc:NavigationView.AutoSuggestBox>
- <Frame x:Name="contentFrame" />
+ <ScrollViewer
+ Margin="12,0,0,0"
+ Padding="4,12,8,0"
+ HorizontalScrollMode="Disabled"
+ VerticalScrollBarVisibility="Auto"
+ VerticalScrollMode="Enabled">
+ <Frame x:Name="contentFrame" />
+ </ScrollViewer>
</muxc:NavigationView>
</Grid>
</Page>
diff --git a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml.cs b/src/dev/impl/DevTools.Impl/Views/MainPage.xaml.cs
index c6eec6d39..2f9e5b23e 100644
--- a/src/dev/impl/DevTools.Impl/Views/MainPage.xaml.cs
+++ b/src/dev/impl/DevTools.Impl/Views/MainPage.xaml.cs
@@ -9,6 +9,7 @@ using DevTools.Impl.ViewModels;
using Microsoft.Toolkit.Mvvm.Messaging;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
namespace DevTools.Impl.Views
@@ -16,6 +17,7 @@ namespace DevTools.Impl.Views
public sealed partial class MainPage : Page, IRecipient<NavigateToToolMessage>
{
private IMefProvider? _mefProvider;
+ private IThread? _thread;
public static readonly DependencyProperty ViewModelProperty =
DependencyProperty.Register(
@@ -49,6 +51,7 @@ namespace DevTools.Impl.Views
var parameters = (NavigationParameter)e.Parameter;
_mefProvider = parameters.ExportProvider;
+ _thread = _mefProvider.Import<IThread>();
// Set the view model
ViewModel = parameters.ExportProvider.Import<MainPageViewModel>();
@@ -66,15 +69,18 @@ namespace DevTools.Impl.Views
public void Receive(NavigateToToolMessage message)
{
- // TODO: Use IThread.ThrowIfNotOnUIThread();
Arguments.NotNull(message, nameof(message));
Assumes.NotNull(_mefProvider, nameof(_mefProvider));
+ Assumes.NotNull(_thread, nameof(_thread));
+
+ _thread!.ThrowIfNotOnUIThread();
contentFrame.Navigate(
message.ViewModel.View,
new NavigationParameter(
_mefProvider!,
- message.ViewModel));
+ message.ViewModel),
+ new EntranceNavigationTransitionInfo());
}
}
}
diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml
new file mode 100644
index 000000000..3b194f75d
--- /dev/null
+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml
@@ -0,0 +1,14 @@
+<Page
+ x:Class="DevTools.Impl.Views.Settings.SettingsToolPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="using:DevTools.Impl.Views.Settings"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d"
+ NavigationCacheMode="Required">
+
+ <Grid>
+ <TextBlock Text="Settings"/>
+ </Grid>
+</Page>
diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml.cs b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml.cs
new file mode 100644
index 000000000..10d9a0392
--- /dev/null
+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolPage.xaml.cs
@@ -0,0 +1,44 @@
+#nullable enable
+
+using DevTools.Core.Navigation;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Navigation;
+
+namespace DevTools.Impl.Views.Settings
+{
+ public sealed partial class SettingsToolPage : Page
+ {
+ public static readonly DependencyProperty ViewModelProperty
+ = DependencyProperty.Register(
+ nameof(ViewModel),
+ typeof(SettingsToolViewModel),
+ typeof(SettingsToolPage),
+ new PropertyMetadata(null));
+
+ /// <summary>
+ /// Gets the page's view model.
+ /// </summary>
+ public SettingsToolViewModel ViewModel
+ {
+ get => (SettingsToolViewModel)GetValue(ViewModelProperty);
+ set => SetValue(ViewModelProperty, value);
+ }
+
+ public SettingsToolPage()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ var parameters = (NavigationParameter)e.Parameter;
+
+ // Set the view model
+ ViewModel = (SettingsToolViewModel)parameters.Parameter!;
+ DataContext = ViewModel;
+
+ base.OnNavigatedTo(e);
+ }
+ }
+}
diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs
index fc7d2395d..f58c23295 100644
--- a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs
+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolProvider.cs
@@ -1,12 +1,12 @@
#nullable enable
-using DevTools.Core.Threading;
using DevTools.Common;
+using DevTools.Core.Injection;
+using DevTools.Core.Threading;
using DevTools.Providers;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.AnimatedVisuals;
-using System;
using System.Composition;
using System.Threading.Tasks;
using Windows.UI.Xaml;
@@ -18,20 +18,22 @@ namespace DevTools.Impl.Views.Settings
[Export(typeof(IToolProvider))]
[Name("Settings")]
[ProtocolName("settings")]
- [CompactOverlaySize(width: 400, height: 300)]
+ [CompactOverlaySize(width: 450, height: 300)]
[IsFooterItem]
internal sealed class SettingsToolProvider : ObservableRecipient, IToolProvider
{
private readonly IThread _thread;
+ private readonly IMefProvider _mefProvider;
public string DisplayName => LanguageManager.Instance.Settings.DisplayName;
public object IconSource { get; }
[ImportingConstructor]
- public SettingsToolProvider(IThread thread)
+ public SettingsToolProvider(IThread thread, IMefProvider mefProvider)
{
_thread = thread;
+ _mefProvider = mefProvider;
IconSource
= new TaskCompletionNotifier<IconElement>(
@@ -58,7 +60,7 @@ namespace DevTools.Impl.Views.Settings
public IToolViewModel CreateTool()
{
- throw new NotImplementedException();
+ return _mefProvider.Import<SettingsToolViewModel>();
}
}
}
diff --git a/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolViewModel.cs b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolViewModel.cs
new file mode 100644
index 000000000..f08e0054c
--- /dev/null
+++ b/src/dev/impl/DevTools.Impl/Views/Settings/SettingsToolViewModel.cs
@@ -0,0 +1,15 @@
+#nullable enable
+
+using DevTools.Providers;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using System;
+using System.Composition;
+
+namespace DevTools.Impl.Views.Settings
+{
+ [Export(typeof(SettingsToolViewModel))]
+ public sealed class SettingsToolViewModel : ObservableRecipient, IToolViewModel
+ {
+ public Type View { get; } = typeof(SettingsToolPage);
+ }
+}