Inheritance: Windows.UI.Xaml.DependencyObject, IGeneralTransform, IGeneralTransformOverrides
        private async void pinButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.flipView.SelectedItem != null)
            {
                ApressBook selectedBook = (ApressBook)this.flipView.SelectedItem;

                this.BottomAppBar.IsSticky = true;

                string uniqueTileID            = selectedBook.ApressBookISBN;
                string shortTileName           = selectedBook.ApressBookName;
                string displayTileName         = selectedBook.ApressBookTechnology;
                string tileActivationArguments = uniqueTileID;
                Uri    logo = new Uri("ms-appx://" + selectedBook.ApressBookImageURI);

                SecondaryTile secondaryTile = new SecondaryTile(uniqueTileID, shortTileName, displayTileName, tileActivationArguments, TileOptions.ShowNameOnLogo, logo);
                secondaryTile.ForegroundText = ForegroundText.Light;
                secondaryTile.SmallLogo      = new Uri("ms-appx:///Assets/SmallLogo.png");

                FrameworkElement pinToStartButton = (FrameworkElement)pinButton;
                Windows.UI.Xaml.Media.GeneralTransform buttonTransform = pinToStartButton.TransformToVisual(null);
                Windows.Foundation.Point point = buttonTransform.TransformPoint(new Point());
                Windows.Foundation.Rect  rect  = new Rect(point, new Size(pinToStartButton.ActualWidth, pinToStartButton.ActualHeight));

                bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(rect, Windows.UI.Popups.Placement.Above);

                this.BottomAppBar.IsSticky = false;
            }
        }
        public static Rect GetElementRect(Windows.UI.Xaml.FrameworkElement element)
        {
            Windows.UI.Xaml.Media.GeneralTransform transform = element.TransformToVisual(null);
            Point point = transform.TransformPoint(new Point());

            return(new Rect(point, new Size(element.ActualWidth, element.ActualHeight)));
        }
Example #3
0
 private async void Button_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (((Button)sender).DataContext != null && ((Button)sender).DataContext is Feature.DataModel.SampleItem)
     {
         Feature.DataModel.SampleItem sampleItem = ((Button)sender).DataContext as Feature.DataModel.SampleItem;
         this.currentSampleItem = sampleItem;
         if (sampleItem.Option.Contains("选座"))
         {
             this.clearSelect();
             this.StoryexpansionSeat.Begin();
         }
         else
         {
             var appointment = new Windows.ApplicationModel.Appointments.Appointment();
             appointment.Subject   = this.sampleItem.Title;
             appointment.StartTime = new DateTimeOffset(DateTime.Now.AddSeconds(1));
             appointment.Duration  = TimeSpan.FromSeconds(1);
             appointment.Location  = "beijing";
             Windows.UI.Xaml.Media.GeneralTransform buttonTransform = (sender as FrameworkElement).TransformToVisual(null);
             Windows.Foundation.Point point = buttonTransform.TransformPoint(new Windows.Foundation.Point());
             var rect = new Windows.Foundation.Rect(point, new Windows.Foundation.Size((sender as FrameworkElement).ActualWidth, (sender as FrameworkElement).ActualHeight));
             await Windows.ApplicationModel.Appointments.AppointmentManager.ShowAddAppointmentAsync(appointment, rect, Windows.UI.Popups.Placement.Default);
         }
     }
 }
        // The Open With dialog should be displayed just under the element that triggered it.
        private Windows.Foundation.Point GetOpenWithPosition(FrameworkElement element)
        {
            Windows.UI.Xaml.Media.GeneralTransform buttonTransform = element.TransformToVisual(null);

            Point desiredLocation = buttonTransform.TransformPoint(new Point());

            desiredLocation.Y = desiredLocation.Y + element.ActualHeight;

            return(desiredLocation);
        }
Example #5
0
        private async void OpenContact_Click(object sender, RoutedEventArgs e)
        {
            // Get the selection rect of the button pressed to show contact card.
            FrameworkElement element = (FrameworkElement)sender;

            Windows.UI.Xaml.Media.GeneralTransform buttonTransform = element.TransformToVisual(null);
            Windows.Foundation.Point point = buttonTransform.TransformPoint(new Windows.Foundation.Point());
            Windows.Foundation.Rect  rect  =
                new Windows.Foundation.Rect(point, new Windows.Foundation.Size(element.ActualWidth, element.ActualHeight));

            // helper method to find a contact just for illustrative purposes.
            Windows.ApplicationModel.Contacts.Contact contact = await findContact("*****@*****.**");


            //Show Contact in contact Application
            FullContactCardOptions options = new FullContactCardOptions();

            options.DesiredRemainingView = ViewSizePreference.UseHalf;

            // Show the full contact card.
            ContactManager.ShowFullContactCard(contact, options);
        }