1. Windows Central Question's Avatar
    I need some help fixing my windows phone application program in C#. I need help in figuring out how to use the menuitem color to change from color to color when I click on it under each button (SOS and strobe).

    The point of the program is to make a app that will act like a flashlight. The two icons on the bottom will be SOS and Strobe; when you click on SOS it will display whatever color is selected with the SOS sequence and when you click on Strobe it will flash the color you choose. (the color by default will be white).

    If anyone could help me figure this out, I would be grateful.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Controls;
    using Microsoft.Phone.Controls;
    using Microsoft.Phone.Shell;
    using System.Windows.Media;

    namespace Assgn2_v1_0
    {
    public partial class MainPage : PhoneApplicationPage
    {

    private void BSOSIcon_Click(object sender, EventArgs e)
    {
    ApplicationBarIconButton btn = (ApplicationBarIconButton)ApplicationBar.Buttons[0];
    //btn.Text = "pause";
    //MessageBox.Show("SOS works!");
    btn.IconUri = new Uri("/Images/appbar.cancel.rest.png", UriKind.Relative);
    //String clr = (sender as IApplicationBarMenuItem).Text;
    btn.IsEnabled = false;
    String clr = "white";

    this.onBrush = (SolidColorBrush)this.Resources[clr];
    this.ContentPanel.Background = onBrush;

    }
    private void BSTROBEIcon_Click(object sender, EventArgs e)
    {
    ApplicationBarIconButton btn = (ApplicationBarIconButton)ApplicationBar.Buttons[1];

    //btn.Text = "pause";
    //MessageBox.Show("STROBE works!");
    String clr1 = "green";

    this.onBrush = (SolidColorBrush)this.Resources[clr1];
    this.ContentPanel.Background = onBrush;
    btn.IconUri = new Uri("/Images/appbar.cancel.rest.png", UriKind.Relative);
    btn.IsEnabled = false;
    //SOSIcon.IconUri = new Uri("/Images/appbar_sync_rest.png", UriKind.Relative);
    //SOSIcon.IsEnabled = true;
    }

    private void MenuItem_click (object sender, EventArgs e)
    {
    ApplicationBarMenuItem menuItem1 = new ApplicationBarMenuItem();
    menuItem1.Text = "red";
    ApplicationBar.MenuItems.Add(menuItem1);
    menuItem1.Click += new EventHandler(menuItem1_Click);

    }
    }
    02-23-2015 09:28 PM
  2. Laura Knotek's Avatar
    This question is too complex for developers to answer for an anonymous user. Please register at WindowsCentral and post your question in the Developers Corner forum.
  3. Laura Knotek's Avatar
    This question is too complex for developers to answer for an anonymous user. Please register at WindowsCentral and post your question in the Developers Corner forum.
    jmshub likes this.
    02-24-2015 02:18 AM

Similar Threads

  1. Replies: 3
    Last Post: 02-24-2015, 06:10 PM
  2. When are we going to see USB 3.1 in phones?
    By Cody Patterson in forum Ask a Question
    Replies: 2
    Last Post: 02-24-2015, 05:07 PM
  3. Broke my phone, got an identical one, how can I transfer all my files over?
    By Windows Central Question in forum Ask a Question
    Replies: 1
    Last Post: 02-23-2015, 10:13 PM
  4. Kazam introduces 3 Windows 8.1 tablets ahead of Mobile World Congress
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 02-23-2015, 06:11 PM
  5. Kazam announces 2 new Windows Phones ahead of Mobile World Congress
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 02-23-2015, 06:11 PM
LINK TO POST COPIED TO CLIPBOARD