Skip to content

Addition in a custom theme

Lacro59 edited this page Dec 23, 2021 · 13 revisions

You can see a example with https://github.com/Lacro59/playnite-defaultextend-theme.

Differents resources disponible with PluginSettings

The SourceName for the plugin is BackgroundChanger

Plugin settings

CustomOption Type Default Description
EnableBackgroundImage bool false Parameters to display or not the plugin background image.
EnableImageAnimatedBackground bool false Indicates if background image animation is enabled.
EnableCoverImage bool false Parameters to display or not the plugin cover image.
EnableImageAnimatedCover bool false Indicates if cover image animation is enabled.

Plugin data for game selected

CustomOption Type Default Description
HasDataBackground bool false Indicates if the game has background images.
HasDataCover bool false Indicates if the game has cover images

Integration of plugin elements with ContentControl

Visibility

Visibility according to the presence of the plugin

<StackPanel Visibility="{PluginStatus Plugin=<PluginId>, Status=Installed}">
</StackPanel>

Visibility depending the element visibility parameter in plugin settings

If the item is not enabled in the plugin settings, it is collapsed.

Visibility according to the visibility of the element

<StackPanel Visibility="{Binding ElementName=<SourceName>_<ElementName>, Path=Visibility}">
</StackPanel>

Plugin elements

Show background images changer

<StackPanel Tag="{PluginSettings Plugin=BackgroundChanger, Path=HasDataBackground}">
	<StackPanel.Style>
		<Style TargetType="{x:Type StackPanel}">
			<Setter Property="Visibility" Value="Visible" />
			<Style.Triggers>
				<DataTrigger Binding="{Binding ElementName=BackgroundChanger_PluginBackgroundImage, Path=Visibility}" Value="Visible">
					<Setter Property="Visibility" Value="Collapsed" />
				</DataTrigger>
			</Style.Triggers>
		</Style>
	</StackPanel.Style>

	<FadeImage x:Name="PART_ImageBackground" Stretch="Uniform" 
			   HorizontalAlignment="Center" VerticalAlignment="Top">
		<FadeImage.ImageOpacityMask>
			<RadialGradientBrush GradientOrigin="0.5,0" Center="0.5,0" RadiusX="2" RadiusY="0.9">
				<RadialGradientBrush.GradientStops>
					<GradientStop Color="Black" Offset="0.3" />
					<GradientStop Color="Transparent" Offset="1" />
				</RadialGradientBrush.GradientStops>
			</RadialGradientBrush>
		</FadeImage.ImageOpacityMask>
	</FadeImage>
</StackPanel>

<!-- BackgroundChanger plugin background -->
<ContentControl x:Name="BackgroundChanger_PluginBackgroundImage"
		HorizontalAlignment="Center" VerticalAlignment="Top" />

Show cover images changer

<StackPanel DockPanel.Dock="Right" VerticalAlignment="Bottom"
            Tag="{PluginSettings Plugin=BackgroundChanger, Path=HasDataCover}">
    <StackPanel.Style>
        <Style TargetType="{x:Type StackPanel}">
            <Setter Property="Visibility" Value="Visible" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding ElementName=BackgroundChanger_PluginCoverImage, Path=Visibility}" Value="Visible">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>
	
    <Image Name="PART_ImageCover" VerticalAlignment="Bottom"
           Height="{Settings GameDetailsCoverHeight}"
           StretchDirection="Both" Stretch="Uniform"
           RenderOptions.BitmapScalingMode="Fant" />
</StackPanel>

<ContentControl x:Name="BackgroundChanger_PluginCoverImage"
                DockPanel.Dock="Right" VerticalAlignment="Bottom"
                Height="{Settings GameDetailsCoverHeight}" />