Skip to content

Commit

Permalink
Display icons in links with ThemeExtras extension
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Mar 14, 2024
1 parent 3c1dc7d commit 5712c2a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/Constants.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@

<SolidColorBrush x:Key="SearchWindowBackgroundBrush" Color="#3c3a3d" />
<SolidColorBrush x:Key="SearchWindowSearchTextForegroundBrush" Color="#cac9cb" />

<sys:String x:Key="DefaultLinkIcon">&#xEF71;</sys:String>
<!-- Noise Brush obtained from https://github.com/felixkmh/StartPage-for-Playnite/-->
<ImageBrush x:Key="DarkNoiseBrush" ImageSource="{ThemeFile 'Images/dark_noise.png'}" TileMode="Tile" Viewport="0,0,100,100" ViewportUnits="Absolute"
Opacity="1" popt:Freeze="True"/>
Expand Down
24 changes: 24 additions & 0 deletions source/DerivedStyles/PropertyItemButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,28 @@
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="PropertyItemLinkButton" TargetType="Button" BasedOn="{StaticResource PropertyItemButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<DockPanel>
<Viewbox DockPanel.Dock="Left" Margin="0,0,5,0" Width="18" Height="18"
VerticalAlignment="Center"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}"
RenderOptions.ClearTypeHint="Enabled" RenderOptions.BitmapScalingMode="Fant">
<ContentControl Content="{Binding Value, TargetNullValue={StaticResource LinksIcon}}"
DataContext="{Binding Url, Converter={PluginConverter Plugin=ThemeExtras, Converter=UrlToAsyncIconConverter}}"/>
</Viewbox>
<TextBlock DockPanel.Dock="Left" FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Content, Converter={StaticResource ObjectToStringConverter}}"
TextTrimming="CharacterEllipsis"
TextWrapping="{TemplateBinding TextBlock.TextWrapping}"/>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
18 changes: 17 additions & 1 deletion source/Views/DetailsViewGameOverview.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,23 @@
<TextBlock Text="{DynamicResource LOCLinksLabel}" />
</StackPanel>
</Label>
<ItemsControl Name="PART_ItemsLinks" />
<ItemsControl ItemsSource="{Binding Game.Links}"
Visibility="{Binding ElementName=PART_ElemLinks, Path=Visibility}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type Link}">
<Button Content="{Binding Name}"
Style="{StaticResource PropertyItemLinkButton}"
ToolTip="{Binding Url}"
Command="{Binding RelativeSource={RelativeSource AncestorType=ItemsControl}, Path=DataContext.OpenLinkCommand}"
CommandParameter="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GridEx>
<!--#regionend-->
</StackPanel>
Expand Down
18 changes: 17 additions & 1 deletion source/Views/GridViewGameOverview.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,23 @@
<TextBlock Text="{DynamicResource LOCLinksLabel}" />
</StackPanel>
</Label>
<ItemsControl Name="PART_ItemsLinks" />
<ItemsControl ItemsSource="{Binding Game.Links}"
Visibility="{Binding ElementName=PART_ElemLinks, Path=Visibility}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type Link}">
<Button Content="{Binding Name}"
Style="{StaticResource PropertyItemLinkButton}"
ToolTip="{Binding Url}"
Command="{Binding RelativeSource={RelativeSource AncestorType=ItemsControl}, Path=DataContext.OpenLinkCommand}"
CommandParameter="{Binding}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</GridEx>
</StackPanel>
</Expander>
Expand Down

0 comments on commit 5712c2a

Please sign in to comment.