[OOBE] Refactor UI code, minor UI tweaks (#16578)

* Move content to dedicated XAML

* Select modules enum

* Remove redundant code, UI fixes

* Markdown rendering tweaks

* Address feedback
This commit is contained in:
Niels Laute
2022-03-08 16:27:17 +01:00
committed by GitHub
parent 139c6c2c8d
commit 9cf39654d9
25 changed files with 341 additions and 344 deletions

View File

@@ -17,7 +17,7 @@
</Grid.RowDefinitions>
<Image x:Name="HeaderImage"
Source="{x:Bind ModuleImageSource}"
Source="{x:Bind HeroImage}"
Stretch="UniformToFill" />
<ScrollViewer Grid.Row="1"
@@ -27,18 +27,18 @@
VerticalAlignment="Top">
<TextBlock x:Name="TitleTxt"
Text="{x:Bind ModuleTitle}"
Text="{x:Bind Title}"
AutomationProperties.HeadingLevel="Level1"
Style="{StaticResource TitleTextBlockStyle}" />
<TextBlock x:Name="DescriptionTxt"
Margin="0,8,0,0"
Text="{x:Bind ModuleDescription}"
Text="{x:Bind Description}"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
TextWrapping="Wrap" />
<ContentPresenter x:Name="ModuleContentPresenter"
Content="{x:Bind ModuleContent}"
Content="{x:Bind PageContent}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Margin="0,12,0,0"/>

View File

@@ -14,33 +14,33 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
this.InitializeComponent();
}
public string ModuleTitle
public string Title
{
get { return (string)GetValue(ModuleTitleProperty); }
set { SetValue(ModuleTitleProperty, value); }
get { return (string)GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
public string ModuleDescription
public string Description
{
get => (string)GetValue(ModuleDescriptionProperty);
set => SetValue(ModuleDescriptionProperty, value);
get => (string)GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value);
}
public string ModuleImageSource
public string HeroImage
{
get => (string)GetValue(ModuleImageSourceProperty);
set => SetValue(ModuleImageSourceProperty, value);
get => (string)GetValue(HeroImageProperty);
set => SetValue(HeroImageProperty, value);
}
public object ModuleContent
public object PageContent
{
get { return (object)GetValue(ModuleContentProperty); }
set { SetValue(ModuleContentProperty, value); }
get { return (object)GetValue(PageContentProperty); }
set { SetValue(PageContentProperty, value); }
}
public static readonly DependencyProperty ModuleTitleProperty = DependencyProperty.Register("ModuleTitle", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty ModuleDescriptionProperty = DependencyProperty.Register("ModuleDescription", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty ModuleImageSourceProperty = DependencyProperty.Register("ModuleImageSource", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty ModuleContentProperty = DependencyProperty.Register("ModuleContent", typeof(object), typeof(SettingsPageControl), new PropertyMetadata(new Grid()));
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register("Description", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty HeroImageProperty = DependencyProperty.Register("HeroImage", typeof(string), typeof(SettingsPageControl), new PropertyMetadata(default(string)));
public static readonly DependencyProperty PageContentProperty = DependencyProperty.Register("PageContent", typeof(object), typeof(SettingsPageControl), new PropertyMetadata(new Grid()));
}
}