Skip to content

Addition in a custom theme (Playnite 8)

Lacro59 edited this page Sep 3, 2021 · 1 revision

In full screen application only the differents resources are available.

Differents resources disponible with DynamicResource

Name Type Default Description
Cl_HasData bool false if have data
Cl_HasNativeSupport bool false if support native language
Cl_ListNativeSupport List Localization List.Empty details

Code integration example with options "Custom theme integration"

Show a element if there is data

<StackPanel Tag="{DynamicResource Cl_HasData}">
    <StackPanel.Style>
        <Style>
            <Setter Property="Visibility" Value="Visible" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="False">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>

    <here your custom code or a element predefined with extension>
</StackPanel>

Show a element if the plugin is actived

<StackPanel Tag="{DynamicResource Cl_HasData}">
    <StackPanel.Style>
        <Style>
            <Setter Property="Visibility" Value="Visible" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="{x:Null}">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>

    <here your custom code or a element predefined with extension>
</StackPanel>

Show a element if there is data and the plugin is actived

<StackPanel Tag="{DynamicResource Cl_HasData}">
    <StackPanel.Style>
        <Style>
            <Setter Property="Visibility" Value="Visible" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="{x:Null}">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="False">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </StackPanel.Style>

    <here your custom code or a element predefined with extension>
</StackPanel>

Example to use Cl_ListNativeSupport

<ListBox ItemsSource="{DynamicResource Cl_ListNativeSupport}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Grid Margin="0,2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                
                <TextBlock Grid.Column="0" Text="{Binding DisplayName}" />
                <Image Grid.Column="1" HorizontalAlignment="Center" Height="24" VerticalAlignment="Center" Width="24" Source="{Binding UiIcon}"/>
                <Image Grid.Column="2" HorizontalAlignment="Center" Height="24" VerticalAlignment="Center" Width="24" Source="{Binding AudioIcon}"/>
                <Image Grid.Column="3" HorizontalAlignment="Center" Height="24" VerticalAlignment="Center" Width="24" Source="{Binding SubIcon}"/>
                <TextBlock Grid.Column="4"  Text="{Binding Notes}" />
            </Grid>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Show a button that open plugin view

<StackPanel Name="PART_ClButtonWithJustIcon" With="optional" Height="optional" />

<StackPanel Name="PART_ClButtonWithTitle" With="optional" Height="optional" />

Show a button advanced with list game localizations

<StackPanel Name="PART_ClButtonWithJustIconAndDetails" With="optional" Height="optional" />

<StackPanel Name="PART_ClButtonWithTitleAndDetails" With="optional" Height="optional" />

Create a custom button what open plugin view

<Button Name="PART_ClCustomButton">your custom template here</Button>

Show list languages available

<StackPanel Name="PART_ClListLanguages" With="optional" Height="optional" />