本文整理汇总了C#中Microsoft.Phone.Shell.ApplicationBarMenuItem类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationBarMenuItem类的具体用法?C# ApplicationBarMenuItem怎么用?C# ApplicationBarMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationBarMenuItem类属于Microsoft.Phone.Shell命名空间,在下文中一共展示了ApplicationBarMenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildLocalizedApplicationBar
// Sample code for building a localized ApplicationBar
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
// Create a new button and set the text value to the localized string from AppResources.
//ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
//appBarButton.Text = AppResources.AppBarButtonText;
//ApplicationBar.Buttons.Add(appBarButton);
// Create a new menu item with the localized string from AppResources.
ApplicationBarMenuItem appBarGreyMenuItem = new ApplicationBarMenuItem("Grey");
appBarGreyMenuItem.Click += appBarGreyMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarGreyMenuItem);
ApplicationBarMenuItem appBarBlackWhiteMenuItem = new ApplicationBarMenuItem("Black/White");
appBarBlackWhiteMenuItem.Click += appBarBlackWhiteMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarBlackWhiteMenuItem);
ApplicationBarMenuItem appBarRedMenuItem = new ApplicationBarMenuItem("Red");
appBarRedMenuItem.Click += appBarRedMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarRedMenuItem);
ApplicationBarMenuItem appBarInverseMenuItem = new ApplicationBarMenuItem("Inverse");
appBarInverseMenuItem.Click += appBarInverseMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarInverseMenuItem);
ApplicationBarMenuItem appBarBlueYellowMenuItem = new ApplicationBarMenuItem("Blue/Yellow");
appBarBlueYellowMenuItem.Click += appBarBlueYellowMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarBlueYellowMenuItem);
ApplicationBar.Mode = ApplicationBarMode.Minimized;
}
示例2: BuildLocalizedApplicationBar
private void BuildLocalizedApplicationBar()
{
ApplicationBar = new ApplicationBar();
ApplicationBarIconButton sendButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/feature.email.png", UriKind.Relative));
sendButton.Text = AppResources.SendButtonText;
ApplicationBar.Buttons.Add(sendButton);
sendButton.Click += Send;
// TODO: Need paperclip icon
ApplicationBarIconButton attachButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/attach.png", UriKind.Relative));
attachButton.Text = AppResources.AttachButtonText;
ApplicationBar.Buttons.Add(attachButton);
attachButton.Click += Attach;
ApplicationBarIconButton discardButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/cancel.png", UriKind.Relative));
discardButton.Text = AppResources.DiscardButtonText;
ApplicationBar.Buttons.Add(discardButton);
discardButton.Click += Discard;
ApplicationBarIconButton dictateButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/microphone.png", UriKind.Relative));
dictateButton.Text = AppResources.DictateButtonText;
ApplicationBar.Buttons.Add(dictateButton);
dictateButton.Click += Dictate;
ApplicationBarMenuItem labelMenuItem = new ApplicationBarMenuItem(AppResources.LabelItemText);
ApplicationBar.MenuItems.Add(labelMenuItem);
labelMenuItem.Click += LabelClick;
}
示例3: MainPage
// Constructor
public MainPage()
{
InitializeComponent();
startTime = DateTime.Now;
if (Debugger.IsAttached)
{
DebugPanel.Visibility = Visibility.Visible;
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Minimized;
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = true;
// Adding a menu item
ApplicationBarMenuItem myMenuItem = new ApplicationBarMenuItem();
myMenuItem.Text = "open debugger";
myMenuItem.Click += toggleDebugger;
ApplicationBar.MenuItems.Add(myMenuItem);
// Adding a menu item
ApplicationBarMenuItem minDebugger = new ApplicationBarMenuItem();
minDebugger.Text = "minimize debugger";
minDebugger.Click += minDebug;
ApplicationBar.MenuItems.Add(minDebugger);
}
}
示例4: BuildLocalizedApplicationBar
// Sample code for building a localized ApplicationBar
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton appBarButtonHear = new ApplicationBarIconButton(new Uri("/Images/QuestionMark.png", UriKind.Relative));
appBarButtonHear.Text = "Hear";
appBarButtonHear.Click += appBarButton_Click;
ApplicationBar.Buttons.Add(appBarButtonHear);
ApplicationBarIconButton appBarButtonShare = new ApplicationBarIconButton(new Uri("/Images/share.png", UriKind.Relative));
appBarButtonShare.Text = "Share";
appBarButtonShare.Click += appBarButtonShare_Click;
ApplicationBar.Buttons.Add(appBarButtonShare);
ApplicationBarIconButton appBarButtonReview = new ApplicationBarIconButton(new Uri("/Images/favs.png", UriKind.Relative));
appBarButtonReview.Text = "Review";
appBarButtonReview.Click += appBarButtonReview_Click;
ApplicationBar.Buttons.Add(appBarButtonReview);
ApplicationBarIconButton appBarButtonSpeech = new ApplicationBarIconButton(new Uri("/Images/microphone.png", UriKind.Relative));
appBarButtonSpeech.Text = "Speech";
appBarButtonSpeech.Click += appBarButtonSpeech_Click;
ApplicationBar.Buttons.Add(appBarButtonSpeech);
// Create a new menu item with the localized string from AppResources.
ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
appBarMenuItem.Text = "About";
appBarMenuItem.Click += appBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
}
示例5: BuildApplicationBar
//----------------------------------------------------------------------
#endregion
//----------------------------------------------------------------------
//----------------------------------------------------------------------
#region --- Methods ---
//----------------------------------------------------------------------
/// <summary>
/// Builds the application bar.
/// </summary>
private void BuildApplicationBar()
{
if (ApplicationBar == null)
{
ApplicationBar = new ApplicationBar();
}
var addButton = new ApplicationBarIconButton(new Uri("/Images/ApplicationBar/GroupManagement/add.png", UriKind.Relative));
addButton.Text = AppResources.UI_GroupManagement_ApplicationBar_Add;
addButton.Click += Add;
_deleteButton = new ApplicationBarIconButton(new Uri("/Images/ApplicationBar/GroupManagement/delete.png", UriKind.Relative));
_deleteButton.Text = AppResources.UI_GroupManagement_ApplicationBar_Delete;
_deleteButton.Click += Delete;
_deleteAllMenuItem = new ApplicationBarMenuItem();
_deleteAllMenuItem.Text = AppResources.UI_GroupManagement_ApplicationBar_DeleteAll;
_deleteAllMenuItem.Click += DeleteAll;
ApplicationBar.Buttons.Add(addButton);
ApplicationBar.Buttons.Add(_deleteButton);
ApplicationBar.MenuItems.Add(_deleteAllMenuItem);
UpdateApplicationBarItems();
}
示例6: BuildLocalizedApplicationBar
private void BuildLocalizedApplicationBar()
{
ApplicationBar = new ApplicationBar();
ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem("Visitor");
appBarMenuItem.Click += appBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
}
示例7: BuildLocalizedApplicationBar
//Sample code for building a localized ApplicationBar
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
// Create a new menu item with the localized string from AppResources.
ApplicationBarMenuItem appBarMenuItem;
// Blue
appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarColorBlueText);
appBarMenuItem.Click += appBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
// White
appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarColorWhiteText);
appBarMenuItem.Click += appBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
// Red
appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarColorRedText);
appBarMenuItem.Click += appBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
// Orange
appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarColorOrangeText);
appBarMenuItem.Click += appBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
}
示例8: AddMenuItem
public void AddMenuItem(ApplicationBarMenuItem menuItem)
{
this.MenuItems.Add(menuItem);
if (this.OnMenuItemAdded != null)
this.OnMenuItemAdded(this);
}
示例9: BuildLocalizedApplicationBar
private void BuildLocalizedApplicationBar()
{
ApplicationBar = new ApplicationBar();
ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem("settings");
appBarMenuItem.Click += AppBarMenuItem_Click;
ApplicationBar.MenuItems.Add(appBarMenuItem);
ApplicationBarMenuItem appBarMenuItemTutorial = new ApplicationBarMenuItem("tutorial");
appBarMenuItemTutorial.Click += appBarMenuItemTutorial_Click;
ApplicationBar.MenuItems.Add(appBarMenuItemTutorial);
ApplicationBarMenuItem appBarMenuItemAbout = new ApplicationBarMenuItem("About");
appBarMenuItemAbout.Click += appBarMenuItemAbout_Click;
ApplicationBar.MenuItems.Add(appBarMenuItemAbout);
ApplicationBarMenuItem appBarMenuItemReview = new ApplicationBarMenuItem("review and rate me!");
appBarMenuItemReview.Click += appBarMenuItemReview_Click;
ApplicationBar.MenuItems.Add(appBarMenuItemReview);
#if DEBUG
ApplicationBarIconButton testNoting = new ApplicationBarIconButton(new Uri("/Assets/Tiles/add.png", UriKind.Relative));
testNoting.Text = "Test Noting";
testNoting.Click += testNoting_Click;
ApplicationBar.Buttons.Add(testNoting);
ApplicationBarIconButton testQuestion = new ApplicationBarIconButton(new Uri("/Assets/Tiles/add.png", UriKind.Relative));
testQuestion.Text = "Test Question";
testQuestion.Click += testQuestion_Click;
ApplicationBar.Buttons.Add(testQuestion);
#endif
}
示例10: InitializeApplicationBar
private void InitializeApplicationBar()
{
/**
* Because the app bar isn't a Silverlight control (wtf) we can't use binding in it,
* so if we want localisation we have to create all these in code. Sigh.
**/
ApplicationBarIconButton twitterButton = new ApplicationBarIconButton();
twitterButton.Text = AppResources.AboutPageAppBarTwitterText;
twitterButton.IconUri = new Uri("/Icons/appbar.twitter.bird.png", UriKind.Relative);
twitterButton.Click += TwitterButton_Click;
ApplicationBar.Buttons.Add(twitterButton);
ApplicationBarIconButton emailButton = new ApplicationBarIconButton();
emailButton.Text = AppResources.AboutPageAppBarEmailText;
emailButton.IconUri = new Uri("/Icons/appbar.feature.email.rest.png", UriKind.Relative);
emailButton.Click += EmailButton_Click;
ApplicationBar.Buttons.Add(emailButton);
ApplicationBarIconButton otherAppsButton = new ApplicationBarIconButton();
otherAppsButton.Text = AppResources.AboutPageAppBarOtherAppsText;
otherAppsButton.IconUri = new Uri("/Icons/appbar.marketplace.png", UriKind.Relative);
otherAppsButton.Click += OtherApps_Click;
ApplicationBar.Buttons.Add(otherAppsButton);
ApplicationBarIconButton reviewAppButton = new ApplicationBarIconButton();
reviewAppButton.Text = AppResources.AboutPageAppBarReviewAppText;
reviewAppButton.IconUri = new Uri("/Icons/appbar.favs.rest.png", UriKind.Relative);
reviewAppButton.Click += ReviewApp_Click;
ApplicationBar.Buttons.Add(reviewAppButton);
ApplicationBarMenuItem websiteMenuItem = new ApplicationBarMenuItem();
websiteMenuItem.Text = AppResources.AboutPageAppBarWebsiteText;
websiteMenuItem.Click += WebsiteMenuItem_Click;
ApplicationBar.MenuItems.Add(websiteMenuItem);
}
示例11: CreateButtons
private void CreateButtons()
{
_saveButton = new ApplicationBarIconButton
{
Text = "save",
IconUri = new Uri("Assets/Icons/Save.png", UriKind.Relative),
};
_feedbackItem = new ApplicationBarMenuItem
{
Text = "feedback"
};
_aboutMenuItem = new ApplicationBarMenuItem
{
Text = "about"
};
_saveButton.Click += SaveButton_Click;
_feedbackItem.Click += feedbackItem_Click;
_aboutMenuItem.Click += AboutMenuItem_Click;
ApplicationBar.Buttons.Add(_saveButton);
ApplicationBar.MenuItems.Add(_feedbackItem);
ApplicationBar.MenuItems.Add(_aboutMenuItem);
}
示例12: ListViewPage
public ListViewPage()
{
InitializeComponent();
// Application bar is initialized
ApplicationBar = new ApplicationBar();
sortmenuitem = new ApplicationBarMenuItem("Sort notes");
// ApplicationBar mode is set to default
ApplicationBar.Mode = ApplicationBarMode.Default;
// ApplicationBar opacity is set 1
ApplicationBar.Opacity = 1.0;
// ApplicationBar visibility is set to true
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = true;
// ApplicationBar button is initilized
ApplicationBarIconButton addbtn = new ApplicationBarIconButton();
ApplicationBarIconButton changepass = new ApplicationBarIconButton();
// Application button icon is set
addbtn.IconUri = new Uri("/Assets/AppbarIcons/add.png", UriKind.Relative);
changepass.IconUri = new Uri("/Assets/AppbarIcons/key.png", UriKind.Relative);
// Text to ApplicationBar is set
addbtn.Text = "add notes";
changepass.Text = "Change password";
// ApplicationBar click event is registered
addbtn.Click += addbtn_Click;
changepass.Click += Changepass_Click;
sortmenuitem.Click += Sortmenuitem_Click;
// Button is added to ApplicationBar
ApplicationBar.Buttons.Add(addbtn);
ApplicationBar.Buttons.Add(changepass);
ApplicationBar.MenuItems.Add(sortmenuitem);
}
示例13: MainPage
/// <summary>
/// Constructor.
/// </summary>
public MainPage()
{
InitializeComponent();
VideoCanvas.Tap += new EventHandler<GestureEventArgs>(videoCanvas_Tap);
DataContext = _dataContext;
_progressIndicator.IsIndeterminate = true;
CreateAppBar();
ApplicationBarMenuItem menuItem = new ApplicationBarMenuItem();
menuItem.Text = "about";
menuItem.IsEnabled = false;
ApplicationBar.MenuItems.Add(menuItem);
menuItem.Click += new EventHandler(aboutMenuItem_Click);
ApplicationBarMenuItem uploadMenuItem = new ApplicationBarMenuItem();
uploadMenuItem.Text = "upload settings";
uploadMenuItem.IsEnabled = false;
ApplicationBar.MenuItems.Add(uploadMenuItem);
uploadMenuItem.Click += new EventHandler(uploadSettingsButton_Click);
ApplicationBarMenuItem userMenuItem = new ApplicationBarMenuItem();
userMenuItem.Text = "user settings";
userMenuItem.IsEnabled = false;
ApplicationBar.MenuItems.Add(userMenuItem);
userMenuItem.Click += new EventHandler(userSettingsButton_Click);
// Disable app sleep
PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
phoneAppService.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
示例14: LibraryPage
public LibraryPage()
{
InitializeComponent();
ApplicationBar = ThemeManager.CreateApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Default;
ApplicationBar.Opacity = .8;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = true;
ApplicationBarIconButton backIcon = new ApplicationBarIconButton();
backIcon.IconUri = new Uri("/Images/back.png", UriKind.Relative);
backIcon.Text = "previous";
ApplicationBar.Buttons.Add(backIcon);
backIcon.Click += new EventHandler(backBrowser_Click);
ApplicationBarIconButton refreshIcon = new ApplicationBarIconButton();
refreshIcon.IconUri = new Uri("/Images/refresh.png", UriKind.Relative);
refreshIcon.Text = "refresh";
ApplicationBar.Buttons.Add(refreshIcon);
refreshIcon.Click += new EventHandler(refreshBrowser_Click);
ApplicationBarIconButton forwardIcon = new ApplicationBarIconButton();
forwardIcon.IconUri = new Uri("/Images/next.png", UriKind.Relative);
forwardIcon.Text = "forward";
ApplicationBar.Buttons.Add(forwardIcon);
forwardIcon.Click += new EventHandler(forwardBrowser_Click);
ApplicationBarMenuItem openInBrowser = new ApplicationBarMenuItem();
openInBrowser.Text = "open in browser";
ApplicationBar.MenuItems.Add(openInBrowser);
openInBrowser.Click += new EventHandler(openInBrowser_Click);
}
示例15: OnNavigatedTo
protected override void OnNavigatedTo(
bool cancelled, NavigationEventArgs e)
{
if (cancelled || _entry != null)
return;
var database = Cache.Database;
if (database == null)
{
GoBack<MainPage>();
return;
}
var id = NavigationContext
.QueryString["entry"];
_entry = database.GetEntry(id) ??
CurrentEntry.Entry;
foreach (var field in _entry.CustomFields.Take(3))
{
var item = new ApplicationBarMenuItem(field.Key);
item.Click += (s, _) => SetValue(field.Value);
ApplicationBar.MenuItems.Add(item);
}
}