首页 > 代码库 > WP_3种磁贴效果设置

WP_3种磁贴效果设置

 

private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
        {
            var tileData = http://www.mamicode.com/new FlipTileData()
            {
                //前面数据
                Title = item.Name,
                BackgroundImage = new Uri(item.Images[0], UriKind.Relative),
                //后面数据
                BackTitle = item.Name,
                BackContent = item.Desc.Substring(0, 30),
                BackBackgroundImage = new Uri(item.Images[1], UriKind.Relative),
                //宽屏数据
                WideBackgroundImage = new Uri(item.Images[2], UriKind.Relative),
                WideBackBackgroundImage = new Uri(item.Images[3], UriKind.Relative),
                WideBackContent = item.Desc.Substring(0, 50)
            };
 
            var iconData = http://www.mamicode.com/new IconicTileData
            {
                BackgroundColor = System.Windows.Media.Color.FromArgb(255, 195, 61, 39),
                Count = 3,
                IconImage = new Uri("Assets/Logo.png", UriKind.RelativeOrAbsolute),
                Title = item.Name,
                WideContent1 = item.Desc.Substring(0, 10),
                WideContent2 = item.Desc.Substring(10, 15),
                WideContent3 = item.Desc.Substring(15, 30)
            };
 
            var cycleData = http://www.mamicode.com/new CycleTileData
            {
                Count = 9,
                CycleImages = new List<Uri> { 
                    new Uri(item.Images[0],UriKind.RelativeOrAbsolute),
                    new Uri(item.Images[1],UriKind.RelativeOrAbsolute),
                    new Uri(item.Images[2],UriKind.RelativeOrAbsolute),
                    new Uri(item.Images[3],UriKind.RelativeOrAbsolute)
                },
                SmallBackgroundImage = new Uri("Assets/Logo.png", UriKind.RelativeOrAbsolute),
                Title = item.Name
            };
            try
            {
                ShellTile.Create(new Uri("/ItemDetail.xaml?name=" + item.Name, UriKind.Relative), cycleData, true);
            }
            catch (Exception)
            {
                MessageBox.Show("已经将此页面固定到桌面!");
            }
        }