Skip to content

Commit

Permalink
[Settings]Change text color for disabled controls (#4837)
Browse files Browse the repository at this point in the history
* change text color for disabled controls

* added custom textblock controls and updated FZ Xaml

* updated Image Resizer Page

* updated Shotcut Guid

* updated KBM Settings

* reverted unrealted changes

* reverted unrealted changes

* reverted unrealted changes

* reverted unrealted changes

* updated power launcher

* reverted unrealted changes

* Image Resizer: renoved spaces in file format hint text

* Image Resizer: restored file format header

Co-authored-by: Lavius Motileng <laviusntk>
  • Loading branch information
Nkateko committed Jul 17, 2020
1 parent 13c2ce3 commit e8de6f0
Show file tree
Hide file tree
Showing 20 changed files with 1,207 additions and 710 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.BodyTextBlock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<TextBlock x:Name="CustomTextBlock"
Style="{StaticResource BodyTextBlockStyle}"
Margin="{StaticResource SmallTopMargin}" >
<Interactivity:Interaction.Behaviors>
<Core:DataTriggerBehavior Binding="{Binding Tag, ElementName=CustomTextBlock}" Value="False">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=CustomTextBlock}" PropertyName="Foreground" Value="{ThemeResource SystemColorGrayTextBrush}" />
</Core:DataTriggerBehavior>
<Core:DataTriggerBehavior Binding="{Binding Tag, ElementName=CustomTextBlock}" Value="True">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=CustomTextBlock}" PropertyName="Foreground" Value="{ThemeResource SystemBaseHighColor}" />
</Core:DataTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</TextBlock>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class BodyTextBlock : UserControl
{
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register(
"Text",
typeof(string),
typeof(GroupTitleTextBlock),
null);

public string _text;

public string Text
{
get
{
return _text;
}

set
{
_text = value;
CustomTextBlock.Text = value;
SetValue(TextProperty, value);
}
}

public static readonly DependencyProperty IsActiveProperty =
DependencyProperty.Register(
"IsActive",
typeof(string),
typeof(GroupTitleTextBlock),
null);

private string _isActive = "False";

public string IsActive
{
get
{
return _isActive;
}

set
{
SetValue(IsActiveProperty, value);
_isActive = value;
CustomTextBlock.Tag = value;
}
}

private Windows.UI.Text.FontWeight _fontWeight;

public Windows.UI.Text.FontWeight FontWeight
{
get
{
return _fontWeight;
}

set
{
_fontWeight = value;
CustomTextBlock.FontWeight = value;
}
}

public BodyTextBlock()
{
this.InitializeComponent();
CustomTextBlock.Tag = "False";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.GroupTitleTextBlock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<TextBlock
x:Name="CustomTextBlock"
Style="{StaticResource SettingsGroupTitleStyle}"
Margin="{StaticResource MediumTopMargin}">
<Interactivity:Interaction.Behaviors>
<Core:DataTriggerBehavior Binding="{Binding Tag, ElementName=CustomTextBlock}" Value="False">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=CustomTextBlock}" PropertyName="Foreground" Value="{ThemeResource SystemColorGrayTextBrush}" />
</Core:DataTriggerBehavior>
<Core:DataTriggerBehavior Binding="{Binding Tag, ElementName=CustomTextBlock}" Value="True">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=CustomTextBlock}" PropertyName="Foreground" Value="{ThemeResource SystemBaseHighColor}" />
</Core:DataTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</TextBlock>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236

namespace Microsoft.PowerToys.Settings.UI.Controls
{
public sealed partial class GroupTitleTextBlock : UserControl
{
public string _text;

public string Text
{
get
{
return _text;
}

set
{
_text = value;
CustomTextBlock.Text = value;
}
}

public static readonly DependencyProperty IsActiveProperty =
DependencyProperty.Register(
"IsActive",
typeof(string),
typeof(GroupTitleTextBlock),
null);

private string _isActive = "False";

public string IsActive
{
get
{
return _isActive;
}

set
{
SetValue(IsActiveProperty, value.ToString());
_isActive = value.ToString();
CustomTextBlock.Tag = value.ToString();
}
}

public GroupTitleTextBlock()
{
this.InitializeComponent();
DataContext = this;
CustomTextBlock.Tag = "False";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,38 @@ public sealed partial class HotkeySettingsControl : UserControl
{
public string Header { get; set; }

public static readonly DependencyProperty IsActiveProperty =
DependencyProperty.Register(
"Enabled",
typeof(string),
typeof(HotkeySettingsControl),
null);

private string _enabled = "False";

public string Enabled
{
get
{
return _enabled;
}

set
{
SetValue(IsActiveProperty, value);
_enabled = value;

if (value.ToString().ToLower() == "true")
{
HotkeyTextBox.IsEnabled = true;
}
else
{
HotkeyTextBox.IsEnabled = false;
}
}
}

public static readonly DependencyProperty HotkeySettingsProperty =
DependencyProperty.Register(
"HotkeySettings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
</Compile>
<Compile Include="Behaviors\NavigationViewHeaderBehavior.cs" />
<Compile Include="Behaviors\NavigationViewHeaderMode.cs" />
<Compile Include="Controls\BodyTextBlock.xaml.cs">
<DependentUpon>BodyTextBlock.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\GroupTitleTextBlock.xaml.cs">
<DependentUpon>GroupTitleTextBlock.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\HotkeySettingsControl.xaml.cs">
<DependentUpon>HotkeySettingsControl.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -195,6 +201,14 @@
<PRIResource Include="Strings\en-us\Resources.resw" />
</ItemGroup>
<ItemGroup>
<Page Include="Controls\BodyTextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\GroupTitleTextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\HotkeySettingsControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
<data name="PowerLauncher_SearchTypePreference_ExecutableName" xml:space="preserve">
<value>Executable name</value>
</data>
<data name="PowerLauncher_MaximumNumberOfResults.Header" xml:space="preserve">
<data name="PowerLauncher_MaximumNumberOfResults.Text" xml:space="preserve">
<value>Maximum number of results</value>
</data>
<data name="PowerLauncher_Shortcuts.Text" xml:space="preserve">
Expand Down Expand Up @@ -389,7 +389,7 @@
<data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Header" xml:space="preserve">
<value>Appear only in extended context menu (Shift + Right-click)</value>
</data>
<data name="PowerRename_Toggle_MaxDispListNum.Header" xml:space="preserve">
<data name="PowerRename_Toggle_MaxDispListNum.Text" xml:space="preserve">
<value>Maximum number of items</value>
</data>
<data name="PowerRename_Toggle_RestoreFlagsOnLaunch.Header" xml:space="preserve">
Expand Down Expand Up @@ -428,7 +428,7 @@
<data name="ShortcutGuide_Description.Text" xml:space="preserve">
<value>Shows a help overlay with Windows shortcuts when the Windows key is pressed.</value>
</data>
<data name="ShortcutGuide_PressTime.Header" xml:space="preserve">
<data name="ShortcutGuide_PressTime.Text" xml:space="preserve">
<value>Press duration before showing (ms)</value>
</data>
<data name="ShortcutGuide_Appearance_Behavior.Text" xml:space="preserve">
Expand All @@ -440,7 +440,7 @@
<data name="ShortcutGuide_OverlayOpacity.Header" xml:space="preserve">
<value>Opacity of background</value>
</data>
<data name="ShortcutGuide_Theme.Header" xml:space="preserve">
<data name="ShortcutGuide_Theme.Text" xml:space="preserve">
<value>Choose Shortcut Guide overlay color</value>
</data>
<data name="ImageResizer_CustomSizes.Text" xml:space="preserve">
Expand Down Expand Up @@ -608,4 +608,19 @@
<data name="FancyZones_RestoreSize.Content" xml:space="preserve">
<value>Restore the original size of windows when unsnapping</value>
</data>
<data name="ImageResizer_FallBackEncoderText.Header" xml:space="preserve">
<value>Fallback encoder</value>
</data>
<data name="ImageResizer_FileFormatDescription.Text" xml:space="preserve">
<value>The following parameters can be used:</value>
</data>
<data name="ImageResizer_FilenameFormatHeader.Header" xml:space="preserve">
<value>Filename format</value>
</data>
<data name="ImageResizer_UseOriginalDate.Content" xml:space="preserve">
<value>Use original date modified</value>
</data>
<data name="Encoding.Text" xml:space="preserve">
<value>Encoding</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@
<!--Extra Extra Small size margins-->
<Thickness x:Key="XXSmallTopMargin">0, 4, 0, 0</Thickness>
<Thickness x:Key="XXSmallTopRightBottomMargin">0, 4, 4, 4</Thickness>

<!--Control Header Text Margin-->
<Thickness x:Key="HeaderTextTopMargin">0, 4, 0, 0</Thickness>
</ResourceDictionary>

0 comments on commit e8de6f0

Please sign in to comment.