mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
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
This commit is contained in:
parent
f542de5421
commit
ab8b6cbe30
@ -15,6 +15,25 @@
|
||||
|
||||
<FontFamily x:Key="Rubik">pack://application:,,,/Resources/Fonts/#Rubik Light</FontFamily>
|
||||
|
||||
<Style TargetType="{x:Type Hyperlink}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{DynamicResource SystemAccentColorTertiary}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="TextDecorations" Value="Underline" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="TextDecorations" Value="None" />
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{DynamicResource SystemAccentColorSecondary}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<converters:ResourceConverter x:Key="ResourceConverter" />
|
||||
<converters:StringFormatConverter x:Key="StringFormatConverter" />
|
||||
</ResourceDictionary>
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,16 +21,30 @@
|
||||
<TextBlock Grid.Column="0" FontSize="14" Text="{Binding Header, ElementName=Control}" />
|
||||
<TextBlock Grid.Column="1" Margin="4,0,0,0">
|
||||
<TextBlock.Style>
|
||||
<Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HelpLink, ElementName=Control}" Value="{x:Null}">
|
||||
<Setter Property="TextBlock.Visibility" Value="Collapsed" />
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
<Hyperlink TextDecorations="None" ToolTip="{x:Static resources:Strings.Menu_MoreInfo}" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="{Binding HelpLink, ElementName=Control}">
|
||||
<ui:SymbolIcon Symbol="QuestionCircle48" Margin="0,1,0,0" />
|
||||
<ui:SymbolIcon Symbol="QuestionCircle48" Margin="0,1,0,0">
|
||||
<ui:SymbolIcon.Style>
|
||||
<Style TargetType="ui:SymbolIcon" BasedOn="{StaticResource {x:Type ui:SymbolIcon}}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{DynamicResource SystemAccentColorTertiary}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:SymbolIcon.Style>
|
||||
</ui:SymbolIcon>
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
Loading…
Reference in New Issue
Block a user