Hide/Show MenuItem

  • Thread starter Thread starter Armando Rocha
  • Start date Start date
A

Armando Rocha

Hi,

How can i Hide a MenuItem from MainMenu?

like that:
menu1.visible = false;

but the menu item dont have a propertie called visible.
 
I think you can only add and remove the .Net CF MenuItems.
Alternatively you could write your own menu.
 
You can't. You have to clear the menu collection then re-add them when
required.
 
hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
}
 
hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);

}

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Armando Rocha said:
Ok, Thanks for the help.

It should work since I do something similar in my code.
Just curious. What does your menu structure look like?
It appears that you're trying to remove a sub-menu item.

- Jin
 
You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
desktop and device frameworks which was introduced on 2.0 and wasn't fixed in
3.5. You will have to clear the submenu collection using the Clear method.
See if this bug report on Microsoft Connect clears things up for you:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Armando Rocha said:
hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
}


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Armando Rocha said:
Ok, Thanks for the help.

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
 
Hi,

I solved the problem.

Thanks Simon and Jin for the help.


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Simon Hart said:
You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
desktop and device frameworks which was introduced on 2.0 and wasn't fixed
in
3.5. You will have to clear the submenu collection using the Clear method.
See if this bug report on Microsoft Connect clears things up for you:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Armando Rocha said:
hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
}


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Armando Rocha said:
Ok, Thanks for the help.

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <[email protected]> escreveu na mensagem
You can't. You have to clear the menu collection then re-add them when
required.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


:

Hi,

How can i Hide a MenuItem from MainMenu?

like that:
menu1.visible = false;

but the menu item dont have a propertie called visible.



--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
 
Great that you got it working. Do you mind telling the group how you fixed
it, regardless of whether you solved it using the solution I mentioned or not
to benefit others ;)
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Armando Rocha said:
Hi,

I solved the problem.

Thanks Simon and Jin for the help.


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Simon Hart said:
You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
desktop and device frameworks which was introduced on 2.0 and wasn't fixed
in
3.5. You will have to clear the submenu collection using the Clear method.
See if this bug report on Microsoft Connect clears things up for you:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Armando Rocha said:
hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
}


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Armando Rocha" <[email protected]> escreveu na mensagem
Ok, Thanks for the help.

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <[email protected]> escreveu na mensagem
You can't. You have to clear the menu collection then re-add them when
required.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


:

Hi,

How can i Hide a MenuItem from MainMenu?

like that:
menu1.visible = false;

but the menu item dont have a propertie called visible.



--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
 
Ok Simon,

The solution i find to remove a specific MenuItem.

I have a Menu structure like that:

- MainMenu

- MenuItem1 [0] - index

- MenuItem2 [1]
- SubItem1 [3]
- Subitem2 [2]
- SubItem3 [1]
- License [0]

In my MainForm Initialize i have a bool parameter (Licensed? Yes/Not):

if (cAppSettings.Licensed){
//I remove the License SubMenu
MenuItem mItem = mainMenu.MenuItems[1].MenuItems[0];
mainMenu.MenuItems[1].MenuItems.Remove(mItem);
}

Its work.


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Simon Hart said:
Great that you got it working. Do you mind telling the group how you fixed
it, regardless of whether you solved it using the solution I mentioned or
not
to benefit others ;)
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


Armando Rocha said:
Hi,

I solved the problem.

Thanks Simon and Jin for the help.


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
Simon Hart said:
You can't do that on CF 2.0/3.5 as this is a bug I believe effects both
desktop and device frameworks which was introduced on 2.0 and wasn't
fixed
in
3.5. You will have to clear the submenu collection using the Clear
method.
See if this bug report on Microsoft Connect clears things up for you:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=201317
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


:

hi,
I put code below to remove a specific item but not work.
any sugestion?

bool status = true;
if (status){
mainMenu.MenuItems.Remove(mainMenu.MenuItems[1].MenuItems[0]);
}


--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Armando Rocha" <[email protected]> escreveu na mensagem
Ok, Thanks for the help.

--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
"Simon Hart [MVP]" <[email protected]> escreveu na mensagem
You can't. You have to clear the menu collection then re-add them
when
required.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


:

Hi,

How can i Hide a MenuItem from MainMenu?

like that:
menu1.visible = false;

but the menu item dont have a propertie called visible.



--
Armando Rocha
Mobile Developer

http://www.ifthensoftware.com
 
Back
Top