From ab8b6cbe305aa3051d8bfbf52b8acb546e536a23 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Wed, 25 Oct 2023 13:48:45 +0100 Subject: [PATCH] Make hyperlinks (and help icons) look less ass i've been using xaml for like a year but i'm only now learning how to properly use it --- Bloxstrap/App.xaml | 19 ++++++++++++++++++ .../UI/Elements/Controls/MarkdownTextBlock.cs | 11 +++------- .../UI/Elements/Controls/OptionControl.xaml | 20 ++++++++++++++++--- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Bloxstrap/App.xaml b/Bloxstrap/App.xaml index 6af052a..22d731b 100644 --- a/Bloxstrap/App.xaml +++ b/Bloxstrap/App.xaml @@ -15,6 +15,25 @@ pack://application:,,,/Resources/Fonts/#Rubik Light + + diff --git a/Bloxstrap/UI/Elements/Controls/MarkdownTextBlock.cs b/Bloxstrap/UI/Elements/Controls/MarkdownTextBlock.cs index cf852ce..dc3359b 100644 --- a/Bloxstrap/UI/Elements/Controls/MarkdownTextBlock.cs +++ b/Bloxstrap/UI/Elements/Controls/MarkdownTextBlock.cs @@ -50,11 +50,10 @@ namespace Bloxstrap.UI.Elements.Controls return; MarkdownDocument document = Markdown.Parse((string)dependencyPropertyChangedEventArgs.NewValue); - ParagraphBlock? paragraphBlock = document.FirstOrDefault() as ParagraphBlock; markdownTextBlock.Inlines.Clear(); - if (paragraphBlock == null || paragraphBlock.Inline == null) + if (document.FirstOrDefault() is not ParagraphBlock paragraphBlock || paragraphBlock.Inline == null) return; foreach (var inline in paragraphBlock.Inline) @@ -71,15 +70,11 @@ namespace Bloxstrap.UI.Elements.Controls if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(text)) continue; - var link = new Hyperlink(new Run(text)) + markdownTextBlock.Inlines.Add(new Hyperlink(new Run(text)) { Command = GlobalViewModel.OpenWebpageCommand, CommandParameter = url - }; - - link.SetResourceReference(Control.ForegroundProperty, "TextFillColorPrimaryBrush"); - - markdownTextBlock.Inlines.Add(link); + }); } } } diff --git a/Bloxstrap/UI/Elements/Controls/OptionControl.xaml b/Bloxstrap/UI/Elements/Controls/OptionControl.xaml index db7086e..e2d7213 100644 --- a/Bloxstrap/UI/Elements/Controls/OptionControl.xaml +++ b/Bloxstrap/UI/Elements/Controls/OptionControl.xaml @@ -21,16 +21,30 @@ - - + + + + +