Skip to content

A Swiss Army knife for developers.

Improved consistency between text blocks

Etienne Baudouxf6530b24ed1a
diff --git a/src/dev/impl/DevTools.Common/LanguageManager.cs b/src/dev/impl/DevTools.Common/LanguageManager.cs
index f7ed958e1..78c2f79e4 100644
--- a/src/dev/impl/DevTools.Common/LanguageManager.cs
+++ b/src/dev/impl/DevTools.Common/LanguageManager.cs
@@ -275,6 +275,11 @@ namespace DevTools.Common
{
private readonly ResourceLoader _resources = ResourceLoader.GetForViewIndependentUse("DevTools.Common/JsonFormatter");
+ /// <summary>
+ /// Gets the resource Configuration.
+ /// </summary>
+ public string Configuration => _resources.GetString("Configuration");
+
/// <summary>
/// Gets the resource DisplayName.
/// </summary>
diff --git a/src/dev/impl/DevTools.Common/Strings/en/JsonFormatter.resw b/src/dev/impl/DevTools.Common/Strings/en/JsonFormatter.resw
index 74f54e5fd..7a03270c2 100644
--- a/src/dev/impl/DevTools.Common/Strings/en/JsonFormatter.resw
+++ b/src/dev/impl/DevTools.Common/Strings/en/JsonFormatter.resw
@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="Configuration" xml:space="preserve">
+ <value>Configuration</value>
+ </data>
<data name="DisplayName" xml:space="preserve">
<value>Json Formatter</value>
</data>
diff --git a/src/dev/impl/DevTools.Common/Themes/Custom.xaml b/src/dev/impl/DevTools.Common/Themes/Custom.xaml
index f29f401bf..ddf4c4053 100644
--- a/src/dev/impl/DevTools.Common/Themes/Custom.xaml
+++ b/src/dev/impl/DevTools.Common/Themes/Custom.xaml
@@ -614,8 +614,9 @@
</Style>
<Style x:Key="SubTitleTextBlock" TargetType="TextBlock">
+ <Setter Property="Foreground" Value="{ThemeResource TextControlHeaderForeground}" />
<Setter Property="FontSize" Value="14" />
- <Setter Property="FontWeight" Value="Medium" />
+ <Setter Property="FontWeight" Value="Normal" />
<Setter Property="Margin" Value="0,12,0,0" />
</Style>
</ResourceDictionary>
diff --git a/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml b/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml
index 3708c90e8..4cbc725d6 100644
--- a/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml
+++ b/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml
@@ -28,18 +28,18 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
- <ContentPresenter
- x:Name="HeaderContentPresenter"
+ <TextBlock
+ x:Name="HeaderTextBlock"
x:DeferLoadStrategy="Lazy"
Grid.Row="0"
Grid.Column="0"
- Content="{x:Bind Header}"
- Foreground="{ThemeResource TextControlHeaderForeground}"
+ Text="{x:Bind Header}"
Margin="{ThemeResource TextBoxTopHeaderMargin}"
- FontWeight="Normal"
+ Style="{StaticResource SubTitleTextBlock}"
TextWrapping="Wrap"
VerticalAlignment="Bottom"
- Visibility="Collapsed"/>
+ Visibility="Collapsed">
+ </TextBlock>
<StackPanel
x:Name="CommandsToolBar"
Grid.Row="0"
diff --git a/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml.cs b/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml.cs
index 4600f2a0f..8d3844938 100644
--- a/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml.cs
+++ b/src/dev/impl/DevTools.Common/UI/Controls/CustomTextBox.xaml.cs
@@ -26,9 +26,9 @@ namespace DevTools.Common.UI.Controls
typeof(CustomTextBox),
new PropertyMetadata(null));
- public object Header
+ public string? Header
{
- get => (object)GetValue(HeaderProperty);
+ get => (string?)GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
@@ -264,7 +264,7 @@ namespace DevTools.Common.UI.Controls
{
if (Header is not null)
{
- GetHeaderContentPresenter().Visibility = Visibility.Visible;
+ GetHeaderTextBlock().Visibility = Visibility.Visible;
}
if (IsRichTextEdit)
@@ -360,9 +360,9 @@ namespace DevTools.Common.UI.Controls
return (Button)(InlinedCopyButton ?? FindName(nameof(InlinedCopyButton)));
}
- private ContentPresenter GetHeaderContentPresenter()
+ private TextBlock GetHeaderTextBlock()
{
- return (ContentPresenter)(HeaderContentPresenter ?? FindName(nameof(HeaderContentPresenter)));
+ return (TextBlock)(HeaderTextBlock ?? FindName(nameof(HeaderTextBlock)));
}
private TextBox GetTextBox()
diff --git a/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml b/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml
index 051e4c05a..c34333b82 100644
--- a/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml
+++ b/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml
@@ -66,18 +66,18 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
- <ContentPresenter
- x:Name="HeaderContentPresenter"
+ <TextBlock
+ x:Name="HeaderTextBlock"
x:DeferLoadStrategy="Lazy"
Grid.Row="0"
Grid.Column="0"
- Content="{x:Bind Header}"
- Foreground="{ThemeResource TextControlHeaderForeground}"
+ Text="{x:Bind Header}"
Margin="{ThemeResource TextBoxTopHeaderMargin}"
- FontWeight="Normal"
+ Style="{StaticResource SubTitleTextBlock}"
TextWrapping="Wrap"
VerticalAlignment="Bottom"
- Visibility="Collapsed"/>
+ Visibility="Collapsed">
+ </TextBlock>
<StackPanel
x:Name="CommandsToolBar"
Grid.Row="0"
diff --git a/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml.cs b/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml.cs
index b523473fa..ed6d1b7cf 100644
--- a/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml.cs
+++ b/src/dev/impl/DevTools.Common/UI/Controls/FormattedTextBlock/FormattedTextBlock.xaml.cs
@@ -49,13 +49,13 @@ namespace DevTools.Common.UI.Controls.FormattedTextBlock
public static readonly DependencyProperty HeaderProperty
= DependencyProperty.Register(
nameof(Header),
- typeof(object),
+ typeof(string),
typeof(FormattedTextBlock),
new PropertyMetadata(null));
- public object Header
+ public string? Header
{
- get => (object)GetValue(HeaderProperty);
+ get => (string?)GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
@@ -458,9 +458,9 @@ namespace DevTools.Common.UI.Controls.FormattedTextBlock
return minRequisiteWidth;
}
- private ContentPresenter GetHeaderContentPresenter()
+ private TextBlock GetHeaderTextBlock()
{
- return (ContentPresenter)(HeaderContentPresenter ?? FindName(nameof(HeaderContentPresenter)));
+ return (TextBlock)(HeaderTextBlock ?? FindName(nameof(HeaderTextBlock)));
}
private void OnLoaded(object sender, RoutedEventArgs e)
@@ -469,7 +469,7 @@ namespace DevTools.Common.UI.Controls.FormattedTextBlock
if (Header is not null)
{
- GetHeaderContentPresenter().Visibility = Visibility.Visible;
+ GetHeaderTextBlock().Visibility = Visibility.Visible;
}
ResetRootGridClipping();
diff --git a/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml b/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml
index a4f4ee4c4..b5456432d 100644
--- a/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml
+++ b/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml
@@ -25,18 +25,17 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
- <ContentPresenter
- x:Name="HeaderContentPresenter"
+ <TextBlock
+ x:Name="HeaderTextBlock"
Grid.Row="0"
Grid.Column="0"
- Content="{x:Bind Header}"
+ Text="{x:Bind Header}"
+ Margin="{ThemeResource TextBoxTopHeaderMargin}"
+ Style="{StaticResource SubTitleTextBlock}"
FontFamily="{ThemeResource ContentControlThemeFontFamily}"
- FontWeight="Normal"
- Foreground="{ThemeResource TextControlHeaderForeground}"
- Margin="{ThemeResource RichEditBoxTopHeaderMargin}"
TextWrapping="Wrap"
VerticalAlignment="Bottom">
- </ContentPresenter>
+ </TextBlock>
<StackPanel
x:Name="CommandsToolBar"
Grid.Row="0"
diff --git a/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml.cs b/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml.cs
index 1882f04fa..7d8b82f42 100644
--- a/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml.cs
+++ b/src/dev/impl/DevTools.Common/UI/Controls/TextEditor/TextEditor.xaml.cs
@@ -40,13 +40,13 @@ namespace DevTools.Common.UI.Controls.TextEditor
public static readonly DependencyProperty HeaderProperty
= DependencyProperty.Register(
nameof(Header),
- typeof(object),
+ typeof(string),
typeof(TextEditor),
new PropertyMetadata(null));
- public object Header
+ public string? Header
{
- get => (object)GetValue(HeaderProperty);
+ get => (string?)GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
diff --git a/src/dev/impl/DevTools.Providers.Impl/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml b/src/dev/impl/DevTools.Providers.Impl/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml
index 437f2ee31..c8ffe8948 100644
--- a/src/dev/impl/DevTools.Providers.Impl/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml
+++ b/src/dev/impl/DevTools.Providers.Impl/Tools/Base64EncoderDecoder/Base64EncoderDecoderToolPage.xaml
@@ -9,7 +9,7 @@
mc:Ignorable="d"
NavigationCacheMode="Required">
- <Grid RowSpacing="4" Margin="0,0,0,16">
+ <Grid RowSpacing="12" Margin="0,0,0,16">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
diff --git a/src/dev/impl/DevTools.Providers.Impl/Tools/HashGenerator/HashGeneratorToolPage.xaml b/src/dev/impl/DevTools.Providers.Impl/Tools/HashGenerator/HashGeneratorToolPage.xaml
index 534c065a9..651e9d2a2 100644
--- a/src/dev/impl/DevTools.Providers.Impl/Tools/HashGenerator/HashGeneratorToolPage.xaml
+++ b/src/dev/impl/DevTools.Providers.Impl/Tools/HashGenerator/HashGeneratorToolPage.xaml
@@ -15,17 +15,19 @@
</TransitionCollection>
</StackPanel.ChildrenTransitions>
- <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.Configuration}" />
-
- <controls:ExpandableSettingControl
- Title="{x:Bind ViewModel.Strings.Uppercase}">
- <controls:ExpandableSettingControl.Icon>
- <FontIcon Glyph="&#xF7B2;" />
- </controls:ExpandableSettingControl.Icon>
- <ToggleSwitch
- Style="{StaticResource RightAlignedToggleSwitchStyle}"
- IsOn="{x:Bind ViewModel.IsUppercase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
- </controls:ExpandableSettingControl>
+ <StackPanel Spacing="4" >
+ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.Configuration}" />
+
+ <controls:ExpandableSettingControl
+ Title="{x:Bind ViewModel.Strings.Uppercase}">
+ <controls:ExpandableSettingControl.Icon>
+ <FontIcon Glyph="&#xF7B2;" />
+ </controls:ExpandableSettingControl.Icon>
+ <ToggleSwitch
+ Style="{StaticResource RightAlignedToggleSwitchStyle}"
+ IsOn="{x:Bind ViewModel.IsUppercase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
+ </controls:ExpandableSettingControl>
+ </StackPanel>
<controls:CustomTextBox
Header="{x:Bind ViewModel.Strings.Input}"
diff --git a/src/dev/impl/DevTools.Providers.Impl/Tools/JsonFormatter/JsonFormatterToolPage.xaml b/src/dev/impl/DevTools.Providers.Impl/Tools/JsonFormatter/JsonFormatterToolPage.xaml
index 0271c2544..2e4260e45 100644
--- a/src/dev/impl/DevTools.Providers.Impl/Tools/JsonFormatter/JsonFormatterToolPage.xaml
+++ b/src/dev/impl/DevTools.Providers.Impl/Tools/JsonFormatter/JsonFormatterToolPage.xaml
@@ -23,20 +23,23 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
- <controls:ExpandableSettingControl
- Grid.Row="0"
- VerticalAlignment="Stretch"
- VerticalContentAlignment="Stretch"
- Title="Indentation">
- <ComboBox
- SelectedValuePath="Tag"
- SelectedValue="{x:Bind ViewModel.Indentation, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
- <ComboBoxItem Tag="TwoSpaces" Content="2 spaces"/>
- <ComboBoxItem Tag="FourSpaces" Content="4 spaces"/>
- <ComboBoxItem Tag="OneTab" Content="1 tab"/>
- <ComboBoxItem Tag="Minified" Content="Minified"/>
- </ComboBox>
- </controls:ExpandableSettingControl>
+ <StackPanel Grid.Row="0" Spacing="4" >
+ <TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.Configuration}" />
+
+ <controls:ExpandableSettingControl
+ VerticalAlignment="Stretch"
+ VerticalContentAlignment="Stretch"
+ Title="Indentation">
+ <ComboBox
+ SelectedValuePath="Tag"
+ SelectedValue="{x:Bind ViewModel.Indentation, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
+ <ComboBoxItem Tag="TwoSpaces" Content="2 spaces"/>
+ <ComboBoxItem Tag="FourSpaces" Content="4 spaces"/>
+ <ComboBoxItem Tag="OneTab" Content="1 tab"/>
+ <ComboBoxItem Tag="Minified" Content="Minified"/>
+ </ComboBox>
+ </controls:ExpandableSettingControl>
+ </StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>