Now, I show you how to display pop up menu in windows phone 7. and how can we handle it.
for that you have to create a user control that is your pop up screen. and that is displayed in our home screen in windows phone.
And this is the code behind of User Control as MyUserControl.xaml.cs.
So, Now open HomePage.xaml.cs for display pop up at specific location and you have to handle that pop up. This code helps you.
Please see the namespace also that i have used in my project;
And, yup its Done Easily...!!
for that you have to create a user control that is your pop up screen. and that is displayed in our home screen in windows phone.
// Place your Design of your User Control here
And this is the code behind of User Control as MyUserControl.xaml.cs.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.Windows.Controls.Primitives;
using Microsoft.Phone.Controls;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Media;
namespace NikhilsProject
{
public partial class MyPopUpScreen : UserControl
{
public MyPopUpScreen(String message)
{
InitializeComponent();
txtMessage.Text = message;
txtMessageShadow.Text = message;
}
public void btnYes_Click(object sender, RoutedEventArgs e)
{
// Code that will fire when user clicks Yes button.
}
public void btnNotNow_Click(object sender, RoutedEventArgs e)
{
// Code that will fire when user clicks Not Now button.
}
private void ClosePopup()
{
Popup buyPop = this.Parent as Popup;
buyPop.IsOpen = false;
}
}
}
So, Now open HomePage.xaml.cs for display pop up at specific location and you have to handle that pop up. This code helps you.
Popup MusicPlaying = new Popup();
MusicPlaying.Child = new MyPopUpScreen("Do you want to Stop Music Player");
MusicPlaying.IsOpen = true;
MusicPlaying.VerticalOffset = 100;
MusicPlaying.HorizontalOffset = 25;
MusicPlaying.Closed += (s1, e1) =>
{
// Add you code here to do something
// when the Popup is closed
};
Please see the namespace also that i have used in my project;
And, yup its Done Easily...!!
I think that's Good example for displaying the User Control as a Pop Up..!
ReplyDelete:)
Its Good,
ReplyDeletethrough this i can easily build the pop up menu.
but i need the animation of Pop up Menu.
then what can i do??
please reply me at here or on my email,
i am beginner in Windows phone.
Use Story board for that Animation.
ReplyDelete