簡體   English   中英

在Universal Windows 10 Store應用中創建多個圖塊

[英]Create multiple tiles in Universal Windows 10 Store app

有沒有一種方法可以在一個Universal Windows 10 Store App中動態創建多個圖塊,並且當在每個圖塊(要進入應用程序的位置)上按一下時,我們如何設置應用入口點?單擊時是否有偵聽器?

ps多個不同大小的瓷磚

您可以使用Windows.UI.StartScreen.SecondaryTile創建輔助切片

首先使用靜態方法SecondaryTile.Exists檢查圖塊是否已存在:

if (!SecondaryTile.Exists(tileId))

tileId是您創建的用於唯一標識輔助磁貼的字符串。

創建一個新的輔助磁貼:

var secondaryTile = new SecondaryTile(tileId, displayName, arguments,
                               _squareLogoUri, TileSize.Square150x150);

bool isPinned = await secondaryTile.RequestCreateAsync();

這是在使用Prism且您的應用程序繼承自PrismUnityApplication時導航到輸入圖塊鏈接到的應用程序的一部分的PrismUnityApplication

protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
{
    if (args != null && !string.IsNullOrEmpty(args.Arguments))
    {
        // The app was launched from a Secondary Tile
        // Navigate to the item's page
        NavigationService.Navigate("ItemDetail", args.Arguments);
    }
    else
    {
        // Navigate to the initial page
        NavigationService.Navigate("Hub", null);
    }

    Window.Current.Activate();
    return Task.FromResult<object>(null);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM