Skip to content

A Swiss Army knife for developers.

Fixed title bar text color.

Etienne Baudoux021702e2f9d2
diff --git a/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.cs b/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.cs
index 007fa30ef..28ab90d4e 100644
--- a/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.cs
+++ b/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.cs
@@ -42,6 +42,7 @@ public class TextBlock : StyledComponentBase
.AddClass("no-wrap", NoWrap)
.AddClass("trim", CanTrim)
.AddClass("hide", !IsVisible)
+ .AddClass("disabled", !IsEnabled) // Don't use IsActuallyEnabled
.AddClass("horizontal-center", HorizontalAlignment == UIHorizontalAlignment.Center)
.AddClass(FinalCssClasses)
.Build();
diff --git a/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.scss b/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.scss
index 09907778f..3b0001cd1 100644
--- a/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.scss
+++ b/src/app/dev/DevToys.Blazor/Components/Text/TextBlock/TextBlock.razor.scss
@@ -98,6 +98,10 @@
display: none !important;
}
+ &.disabled {
+ color: var(--text-fill-color-disabled);
+ }
+
&.horizontal-center {
text-align: center;
}
diff --git a/src/app/dev/DevToys.Blazor/Pages/Index.razor b/src/app/dev/DevToys.Blazor/Pages/Index.razor
index e148bc8ba..44c8a362e 100644
--- a/src/app/dev/DevToys.Blazor/Pages/Index.razor
+++ b/src/app/dev/DevToys.Blazor/Pages/Index.razor
@@ -38,7 +38,8 @@
if (OperatingSystem.IsWindows())
{
<TextBlock Text="@TitleBarInfoProvider.Title"
- Style="margin-left: 16px;" />
+ Style="margin-left: 16px;"
+ IsEnabled="@WindowHasFocus"/>
}
}
else
@@ -46,7 +47,8 @@
TitleBarInfoProvider.Title = "DevToys";
if (OperatingSystem.IsWindows())
{
- <TextBlock Text="@TitleBarInfoProvider.Title" />
+ <TextBlock Text="@TitleBarInfoProvider.Title"
+ IsEnabled="@WindowHasFocus" />
}
}
</HeaderLeft>
@@ -66,6 +68,7 @@
IsVisible="@WindowService.IsCompactOverlayModeSupportedByPlatform"
ToolTip="Picture in picture"
@onclick="@OnToggleCompactOverlayModeButtonClick">
+ <!-- TODO: Change FontIcon to support "Rotation" parameter, and change the icon to -->
<FontIcon Glyph="@(WindowService.IsCompactOverlayMode ? '\uE97C' : '\uE97F')" />
</Button>
</StackPanel>
diff --git a/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs b/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs
index 64bcbe5ea..7e9b46bad 100644
--- a/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs
+++ b/src/app/dev/DevToys.Blazor/Pages/Index.razor.cs
@@ -38,6 +38,9 @@ public partial class Index : MefComponentBase
/// </summary>
public bool IsTransitioning { get; set; }
+ [Parameter]
+ public bool WindowHasFocus { get; set; }
+
protected override void OnInitialized()
{
base.OnInitialized();
@@ -45,9 +48,11 @@ public partial class Index : MefComponentBase
ViewModel.SelectedMenuItem = ViewModel.HeaderAndBodyToolViewItems[0];
ContextMenuService.IsContextMenuOpenedChanged += ContextMenuService_IsContextMenuOpenedChanged;
WindowService.WindowActivated += WindowService_WindowActivated;
+ WindowService.WindowDeactivated += WindowService_WindowDeactivated;
TitleBarInfoProvider.PropertyChanged += TitleBarMarginProvider_PropertyChanged;
TitleBarInfoProvider.TitleBarMarginRight = 40;
+ WindowHasFocus = true;
}
private void ViewModel_SelectedMenuItemChanged(object? sender, EventArgs e)
@@ -70,6 +75,9 @@ public partial class Index : MefComponentBase
private void WindowService_WindowActivated(object? sender, EventArgs e)
{
+ WindowHasFocus = true;
+ StateHasChanged();
+
// Start Smart Detection
ViewModel.RunSmartDetectionAsync(WindowService.IsCompactOverlayMode)
.ContinueWith(async _ =>
@@ -78,6 +86,12 @@ public partial class Index : MefComponentBase
});
}
+ private void WindowService_WindowDeactivated(object? sender, EventArgs e)
+ {
+ WindowHasFocus = false;
+ StateHasChanged();
+ }
+
private void OnBackButtonClicked()
{
ViewModel.GoBack();