-
Notifications
You must be signed in to change notification settings - Fork 4
Custom UI Elements
Available custom elements:
ThemeExtras_UserRating
ThemeExtras_CommunityRating
ThemeExtras_CriticRating
ThemeExtras_SettableHidden
ThemeExtras_SettableFavorite
ThemeExtras_SettableUserScore
ThemeExtras_SettableCompletionStatus
ThemeExtras_CompletionStatusComboBox
ThemeExtras_Banner
ThemeExtras_Links
Only ThemeExtras_UserRating
is interactive.
Example:
<StackPanel Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}">
<StackPanel.Resources>
<SolidColorBrush x:Key="Extras_FilledStarBrush" Color="White"/>
<SolidColorBrush x:Key="Extras_EmptyStarBrush" Color="White" Opacity="0.5"/>
</StackPanel.Resources>
<ContentControl x:Name="ThemeExtras_UserRating" Visibility="{Binding UserScoreVisibility}"/>
<ContentControl x:Name="ThemeExtras_CriticRating" Visibility="{Binding CriticScoreVisibility}"/>
<ContentControl x:Name="ThemeExtras_CommunityRating" Visibility="{Binding CommunityScoreVisibility}"/>
</StackPanel>
Example:
<ContentControl x:Name="ThemeExtras_Banner"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}"
RenderOptions.BitmapScalingMode="Fant"/>
ThemeExtras_Links
contains a ItemsControl
that can styled by providing an implicit style as a resource of the ContentControl
. The ItemsSource
is bound to a List<LinkExt>
. LinkExt
extends Link
by the Icon
property and the OpenLinkCommand
.
Example:
<ContentControl x:Name="ThemeExtras_Links"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}">
<ContentControl.Resources>
<Style TargetType="ItemsControl">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<DockPanel Margin="5">
<Viewbox DockPanel.Dock="Left" Margin="0,0,5,0" Width="18" Height="18">
<ContentControl>
<ContentControl.Content>
<Binding Path="Icon">
<Binding.TargetNullValue>
<TextBlock Text=""
Style="{DynamicResource BaseTextBlockStyle}"
FontFamily="{StaticResource FontIcoFont}"/>
</Binding.TargetNullValue>
</Binding>
</ContentControl.Content>
</ContentControl>
</Viewbox>
<TextBlock DockPanel.Dock="Left"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding Url}">
<Hyperlink Command="{Binding OpenLinkCommand}">
<Run Text="{Binding Name}"/>
</Hyperlink>
</TextBlock>
</DockPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Resources>
</ContentControl>
An already styled ComboBox
with animations. Contribution by Jhanlon95.
Example:
<ContentControl x:Name="ThemeExtras_CompletionStatusComboBox"/>
Settable properties allow to change certain game properties and update the game accordingly such that the change persists.
The ContentControl
s only contain an empty UserControl
with a special DataContext
. Every DataContext
of such a UserControl
has the Value
property that can be bound in TwoWay
-mode to allow changing it.
Examples:
<ContentControl x:Name="ThemeExtras_SettableUserScore"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}">
<ContentControl.Resources>
<Style TargetType="{x:Type UserControl}">
<Setter Property="Content">
<Setter.Value>
<NullIntNumericBox Width="30" TextAlignment="Center"
Text="{Binding Value, UpdateSourceTrigger=LostFocus}"
Tag="{Binding Game.UserScoreRating}"
FontSize="{DynamicResource FontSizeLarge}"
FontWeight="SemiBold" VerticalAlignment="Center"
MinValue="0" MaxValue="100"/>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Resources>
</ContentControl>
<ContentControl x:Name="ThemeExtras_SettableFavorite"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}">
<ContentControl.Resources>
<Style TargetType="UserControl">
<Setter Property="Content">
<Setter.Value>
<CheckBox IsChecked="{Binding Value}">
<CheckBox.Template>
<ControlTemplate TargetType="CheckBox">
<Viewbox>
<Grid>
<TextBlock Text=""
FontFamily="{StaticResource FontIcoFont}"
Opacity="{TemplateBinding IsChecked, Converter={StaticResource OpacityBoolConverter}}"/>
</Grid>
</Viewbox>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Resources>
</ContentControl>
<ContentControl x:Name="ThemeExtras_SettableHidden"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}">
<ContentControl.Resources>
<Style TargetType="UserControl">
<Setter Property="Content">
<Setter.Value>
<CheckBox IsChecked="{Binding Value}">
<CheckBox.Template>
<ControlTemplate TargetType="CheckBox">
<Viewbox>
<Grid>
<TextBlock Text="" FontFamily="{StaticResource FontIcoFont}"
Visibility="{TemplateBinding IsChecked, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
<TextBlock Text="" FontFamily="{StaticResource FontIcoFont}"
Visibility="{TemplateBinding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Grid>
</Viewbox>
</ControlTemplate>
</CheckBox.Template>
</CheckBox>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Resources>
</ContentControl>
The DataContext
for this control also has the CompletionStatusOptions
properties which is an ObservableCollection<CompletionStatus>
which contains all available completion statuses.
<ContentControl Margin="0,6,0,0"
Visibility="{PluginStatus Plugin=felixkmh_Extras_Plugin, Status=Installed}"
HorizontalAlignment="Left"
Height="40"
Padding="5"
x:Name="ThemeExtras_SettableCompletionStatus">
<ContentControl.Resources>
<Style TargetType="UserControl">
<Setter Property="Content">
<Setter.Value>
<StackPanel Orientation="Horizontal">
<Grid>
<Viewbox>
<TextBlock Text="" FontFamily="{StaticResource FontIcoFont}"
Style="{StaticResource BaseTextBlockStyle}" HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Viewbox>
</Grid>
<Border Padding="5,0"
Background="Transparent">
<ComboBox ItemsSource="{Binding CompletionStatusOptions}" SelectedItem="{Binding Value}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type CompletionStatus}">
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Border>
</StackPanel>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Resources>
</ContentControl>