读书人

固定襄助磁贴

发布时间: 2013-03-13 10:56:58 作者: rapoo

固定辅助磁贴

   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

读书人网 >移动开发

热点推荐