Thomas がコメントで既に述べたように、Package.appxmanifest でタイルの背景色を変更できます。コードでBackgroundColor="transparent"
は、次のVisualElements
タグにあります。
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="MyApp.App">
<uap:VisualElements DisplayName="MyApp" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="MyApp" BackgroundColor="transparent">
Microsoftアプリのようにアプリに入れたい場合は、コード内を次のように変更できBackgroundColor
ます。SecondaryTile
public static async Task ChangeSecondaryTilesBackground(bool transparent) {
IReadOnlyList<SecondaryTile> tiles = await SecondaryTile.FindAllAsync();
foreach (SecondaryTile tile in tiles) {
if (transparent)
tile.VisualElements.BackgroundColor = Windows.UI.Colors.Transparent;
else
tile.VisualElements.BackgroundColor = Windows.UI.Colors.Green; // Set to your color
await tile.UpdateAsync();
}
}
ここでのプライマリ タイルの更新は少し複雑です。タイルの新しい Xml コンテンツを作成し、背景画像に自分の色のみを含めて設定する必要があるためです。tileUpdater.Update(new TileNotification(xmlContent));
PC では、ユーザーがタイルを右クリックして無効にすると、Package.appxmanifest で設定されたものが使用されることに注意してください。TileNotification コンテンツが正しくないか、読み込みに失敗した場合、appxmanifest の既定のコンテンツも表示されます。
逆の方法 (たとえば、ブランディングが重要な場合) は、appxmanifest に BackgroundColor を保持し、ユーザーがアプリ アイコンのみの透明なライブ タイルを希望する場合は、メインのアプリ アイコンを複製する SecondaryTile を作成するだけです。それが、たとえば PitlaneOne で行った方法です。私がそのようにした理由は、appxmanifest の BackgroundColor を透明に設定すると、アプリケーション リストとストア リストのアプリ アイコンも透明になるためです。