2014-07-16 23 views
0

我有一個Windows應用商店應用程序,目前允許我的用戶將圖釘固定到開始菜單並取消固定。我能夠設置背景和徽標和文字,但問題是我想要瓷磚而不是靜態徽標,我希望它是一個活瓷磚。使用模板的Windows 8次要瓷磚

因此,它將從一邊只有一個圖像,然後翻轉,另一邊將是我的應用信息。我知道你可以對普通的活瓷磚和使用xml這樣做,但我正在使用c#,並希望這可以在我的輔助瓷磚中工作。

任何關於如何去做的幫助都會很棒。

下面是一些代碼我用來創建二次瓦片:

私人異步空隙PinButton_OnClick(對象發件人,RoutedEventArgs E) { 變種項= createdItem.SelectedItem;

if (item != null) 
{ 
    var logo = new Uri(item.image); 
    if (item != null) 
    { 
     var smallLogo = new Uri(item.image); 
     var wideLogo = new Uri(item.image); 
    } 

    string tileActivationArguments = logoSecondaryTileId + "WasPinnedAt=" + 
            DateTime.Now.ToLocalTime(); 
    logoSecondaryTileId = item.ID+ counter.ToString(); 
    counter++; 

    //Create the tile 
    SecondaryTile tile = new SecondaryTile(logoSecondaryTileId, item.Code, item.FirstName + " " + item.LastName, 
     tileActivationArguments, TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo, logo); 

    if (item.SelectedItem is Details) 
    { 

     tile.ForegroundText = ForegroundText.Light; 
     tile.BackgroundColor = Colors.Black; 


     bool isPinned = 
      await 
       tile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement)sender), 
        Placement.Default); 


     if (isPinned) 
     { 
      Messages.InvokeToast(Toast.Created); 
      UnpinButton.Visibility = Visibility.Visible; 
      pinButton.Visibility = Visibility.Collapsed; 
     } 
     else 
     { 
      Messages.InvokeToast(Toast.Error); 
     } 

     if (SecondaryTile.Exists(logoSecondaryTileId)) 
     { 
      var dialog = new MessageDialog("Already exists!") 
      { 
       Title = "Unable to Pin Tile!" 
      }; 
      dialog.Commands.Add(new UICommand("Okay", new UICommandInvokedHandler(CommandHandler))); 
      dialog.CancelCommandIndex = 1; 
      await dialog.ShowAsync(); 
     } 

    } 
} 
} 

回答