我有一个窗口商店应用程序,目前允许我的用户别针和解锁瓷砖到开始菜单。我可以设置一个背景,标志和文字,但问题是,我希望瓷砖取代静态标志与文字,我希望它是一个活生生的瓷砖。
因此,它会从一边,只有一个图像,然后翻转,另一边将是我的应用程序信息。我知道您可以对常规的活瓷砖和xml进行这种操作,但是我使用的是c#,并且希望它能在我的次级瓷砖中工作。
任何关于如何去做的帮助都是很好的。
下面是一些用于创建次要瓷砖的代码:
私有异步无效PinButton_OnClick (对象发送方,RoutedEventArgs e) { var item = 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();
}
}
}
}发布于 2014-07-16 18:15:22
您只需要使用一个具有前、后两个模板的模板来定义瓷砖。有关如何使用模板定义次要瓷砖:Is it possible to use tile templates with secondary tiles in a Windows Store App?,请参见此处。请参见此处列出的可能的模板列表,这些模板具有backs:http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx
https://stackoverflow.com/questions/24787593
复制相似问题