mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11: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>
|
<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:ResourceConverter x:Key="ResourceConverter" />
|
||||||
<converters:StringFormatConverter x:Key="StringFormatConverter" />
|
<converters:StringFormatConverter x:Key="StringFormatConverter" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
@ -50,11 +50,10 @@ namespace Bloxstrap.UI.Elements.Controls
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
MarkdownDocument document = Markdown.Parse((string)dependencyPropertyChangedEventArgs.NewValue);
|
MarkdownDocument document = Markdown.Parse((string)dependencyPropertyChangedEventArgs.NewValue);
|
||||||
ParagraphBlock? paragraphBlock = document.FirstOrDefault() as ParagraphBlock;
|
|
||||||
|
|
||||||
markdownTextBlock.Inlines.Clear();
|
markdownTextBlock.Inlines.Clear();
|
||||||
|
|
||||||
if (paragraphBlock == null || paragraphBlock.Inline == null)
|
if (document.FirstOrDefault() is not ParagraphBlock paragraphBlock || paragraphBlock.Inline == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var inline in paragraphBlock.Inline)
|
foreach (var inline in paragraphBlock.Inline)
|
||||||
@ -71,15 +70,11 @@ namespace Bloxstrap.UI.Elements.Controls
|
|||||||
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(text))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var link = new Hyperlink(new Run(text))
|
markdownTextBlock.Inlines.Add(new Hyperlink(new Run(text))
|
||||||
{
|
{
|
||||||
Command = GlobalViewModel.OpenWebpageCommand,
|
Command = GlobalViewModel.OpenWebpageCommand,
|
||||||
CommandParameter = url
|
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="0" FontSize="14" Text="{Binding Header, ElementName=Control}" />
|
||||||
<TextBlock Grid.Column="1" Margin="4,0,0,0">
|
<TextBlock Grid.Column="1" Margin="4,0,0,0">
|
||||||
<TextBlock.Style>
|
<TextBlock.Style>
|
||||||
<Style>
|
<Style TargetType="TextBlock">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding HelpLink, ElementName=Control}" Value="{x:Null}">
|
<DataTrigger Binding="{Binding HelpLink, ElementName=Control}" Value="{x:Null}">
|
||||||
<Setter Property="TextBlock.Visibility" Value="Collapsed" />
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</TextBlock.Style>
|
</TextBlock.Style>
|
||||||
<Hyperlink TextDecorations="None" ToolTip="{x:Static resources:Strings.Menu_MoreInfo}" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="{Binding HelpLink, ElementName=Control}">
|
<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>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
Loading…
Reference in New Issue
Block a user