name : Shared.AppButton_8_1_RP-591615d7.xaml
<!-- Child template used to display app information with install state and optionally provide activation as well -->
<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:tm="using:SearchUI.TemplateManager"
              x:Key="Shared.AppButton_8_1_RP">
    <Grid>
        <Grid.Resources>
            <!-- Data templates for displaying different sub texts depending on install state -->
            <DataTemplate x:Key="Local.LaunchPrompt">
                <TextBlock Text="{Binding Extended:appInfo.Extended:appLaunchprompt}"
                           Style="{CustomResource Resources.Shared.SerpSecondaryTextStyle}"
                           TextTrimming="CharacterEllipsis"
                           AutomationProperties.AutomationId="AppStateText" />
            </DataTemplate>
            <DataTemplate x:Key="Local.InstallPrompt">
                <TextBlock Text="{Binding Extended:appInfo.Extended:appInstallPrompt}"
                           Style="{CustomResource Resources.Shared.SerpSecondaryTextStyle}"
                           TextTrimming="CharacterEllipsis"
                           AutomationProperties.AutomationId="AppStateText" />
            </DataTemplate>
            <DataTemplate x:Key="Local.UpgradePrompt">
                <TextBlock Text="{Binding Extended:appInfo.Extended:appUpgradePrompt}"
                           Style="{CustomResource Resources.Shared.SerpSecondaryTextStyle}"
                           TextTrimming="CharacterEllipsis"
                           AutomationProperties.AutomationId="AppStateText" />
            </DataTemplate>
            
            <!-- Switch case converter used to pick one of the above subtext datatemplates based on app install state-->
            <tm:SwitchCaseConverter x:Key="Local.InstallStateSubtextConverter"
                                    Default="{StaticResource Local.LaunchPrompt}">
                <tm:SwitchCase Case="0"
                               Value="{StaticResource Local.InstallPrompt}" />
                <tm:SwitchCase Case="1"
                               Value="{StaticResource Local.LaunchPrompt}" />
                <tm:SwitchCase Case="2"
                               Value="{StaticResource Local.UpgradePrompt}" />
            </tm:SwitchCaseConverter>

            <tm:SwitchCaseConverter x:Key="Local.AutomationNameConverter"
                                    Default="{Binding Extended:appInfo.Extended:appLaunchAutomationName}">
                <tm:SwitchCase Case="0"
                               Value="{Binding Extended:appInfo.Extended:appInstallAutomationName}" />
                <tm:SwitchCase Case="1"
                               Value="{Binding Extended:appInfo.Extended:appLaunchAutomationName}" />
                <tm:SwitchCase Case="2"
                               Value="{Binding Extended:appInfo.Extended:appUpgradeAutomationName}" />
            </tm:SwitchCaseConverter>

            <!-- Main data template used when app activation is not required -->
            <!-- This template displays app icon with title and sub text, the subtext is picked using the above converter-->
            <DataTemplate x:Key="Local.AppWithoutActivation">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>                    
                    <Grid Grid.Column="0"
                          Grid.Row="0"
                          Grid.RowSpan="2"
                          Width="40"
                          Height="40"
                          Margin="0, 0, 10, 0"
                          Background="{Binding Extended:appInfo.Extended:tileColor}">
                        <Image Source="{Binding Extended:iconUrl.Extended:src}"                               
                               Stretch="UniformToFill"                               
                               AutomationProperties.AutomationId="AppIcon" 
                               Style="{CustomResource Resources.Shared.BaseImageStyle}" />
                        <Rectangle Style="{CustomResource Resources.Shared.AppIconBorderStyle}" />
                    </Grid>
                    <TextBlock Grid.Row="0"
                               Grid.Column="1"
                               Style="{CustomResource Resources.Shared.AppNameTextStyle}"
                               tm:RichText.Text="{Binding Extended:appInfo.Extended:appDisplayName}"
                               AutomationProperties.AutomationId="AppName" />
                    <ContentControl Grid.Column="1"
                                    Grid.Row="1"
                                    ContentTemplate="{Binding System_ConnectedSearch_AppInstalledState, Converter={StaticResource Local.InstallStateSubtextConverter}}"
                                    AutomationProperties.AutomationId="AppSubText" />
                </Grid>
            </DataTemplate>
            
            <!-- Main data template used when app activation is required -->
            <!-- This template surrounds the app title with a button that has various types of activation based on the app install state -->
            <!-- The inner content is always the data template used for app without activation -->
            <DataTemplate x:Key="Local.AppWithActivation">
                <Button Margin="-10" 
                        Padding="10"
                        Style="{CustomResource Resources.Shared.ResultButtonStyle}"
                        Command="{Binding System_ConnectedSearch_ActivateCommand}"
                        ContentTemplate="{StaticResource Local.AppWithoutActivation}"
                        AutomationProperties.AutomationId="AppLaunchButton"
                        AutomationProperties.Name="{Binding System_ConnectedSearch_AppInstalledState, Converter={StaticResource Local.AutomationNameConverter}}" />
            </DataTemplate>

            <!-- Top level switch case converter that decideds whether to add activatable templates based on parameter thats passed in-->
            <tm:SwitchCaseConverter x:Key="Local.ShowActivationConverter"
                                    Default="{StaticResource Local.AppWithoutActivation}">
                <tm:SwitchCase Case="false"
                               Value="{StaticResource Local.AppWithoutActivation}" />
                <tm:SwitchCase Case="true"
                               Value="{StaticResource Local.AppWithActivation}" />
            </tm:SwitchCaseConverter>
        </Grid.Resources>
        <ContentControl ContentTemplate="{Binding Extended:appInfo.Extended:enableActivation, Converter={StaticResource Local.ShowActivationConverter}}" />
    </Grid>
</DataTemplate>

© 2026 UnknownSec