首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

固定襄助磁贴

2013-03-13 
固定辅助磁贴if (SecondaryTile.Exists(appbarTileId)){SecondaryTile secondaryTile new SecondaryTile

固定辅助磁贴

   if (SecondaryTile.Exists(appbarTileId))            {                SecondaryTile secondaryTile = new SecondaryTile(appbarTileId);                bool isUnpinned = await secondaryTile.RequestDeleteForSelectionAsync(GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Above);            }            else            {                Uri logo = new Uri("ms-appx:///images/150.png");                string tileActivationArguments = appbarTileId + " was pinned at " + DateTime.Now.ToLocalTime().ToString();                SecondaryTile secondaryTile = new SecondaryTile(appbarTileId,                                                                "how do you think?",                                                                "what it is?",                                                                tileActivationArguments,                                                                TileOptions.ShowNameOnLogo,                                                                logo);                secondaryTile.ForegroundText = ForegroundText.Dark;                secondaryTile.SmallLogo = new Uri("ms-appx:///images/150.png");                bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Above);            }  private Rect GetElementRect(FrameworkElement frameworkElement)        {            GeneralTransform buttonTransform = frameworkElement.TransformToVisual(null);            Point point = buttonTransform.TransformPoint(new Point());            return new Rect(point, new Size(frameworkElement.ActualWidth, frameworkElement.ActualHeight));              }






参考链接:http://msdn.microsoft.com/zh-CN/library/windows/apps/xaml/Hh868249(v=win.10).aspx

热点排行