0
最初に表示されるカスタムShellTileを作成する方法はありますか?カウント数(ラベル)のサイズを変更して再配置したいのですが、その方法を見つけることができません。カスタムShellTile
最初に表示されるカスタムShellTileを作成する方法はありますか?カウント数(ラベル)のサイズを変更して再配置したいのですが、その方法を見つけることができません。カスタムShellTile
あなたはタイトルやカウンターの位置やスタイルを変更することはできませんが、例えば、タイルに表示する画像を生成することができます。
WriteableBitmap bitmap = new WriteableBitmap(173, 173);
TextBlock textBlock = new TextBlock();
textBlock.TextWrapping = TextWrapping.Wrap;
textBlock.Foreground = new SolidColorBrush(Colors.White);
textBlock.FontSize = 22.0;
textBlock.Margin = new Thickness(12.0, 8.0, 8.0, 45.0);
textBlock.Text = "Lorem ipsum";
textBlock.HorizontalAlignment = HorizontalAlignment.Stretch;
textBlock.VerticalAlignment = VerticalAlignment.Stretch;
Grid layoutRoot = new Grid();
layoutRoot.Background = (Brush)App.Current.Resources["PhoneAccentBrush"];
layoutRoot.Width = 173.0;
layoutRoot.Height = 173.0;
layoutRoot.Children.Add(textBlock);
layoutRoot.Measure(new Size(173, 173));
layoutRoot.Arrange(new Rect(0, 0, 173, 173));
layoutRoot.UpdateLayout();
bitmap.Render(layoutRoot, null);
bitmap.Invalidate();
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
string fileName = "/Shared/ShellContent/BackgroundImage.jpg";
using (Stream fileStream = storage.CreateFile(fileName))
{
bitmap.SaveJpeg(fileStream, 173, 173, 0, 100);
}
}
StandardTileData tileData = new StandardTileData
{
BackgroundImage = new Uri("isostore:"/Shared/ShellContent/BackgroundImage.jpg, UriKind.Absolute),
Title = "Lorem Ipsum,
};
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), tileData);
私は同じことを考えていました。コードのTnx! – paxx