.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WPF MenuItem CommandParameter specifie in style not available on menu first open

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :WPF
I am specifying a context menu within the ControlTemplate of a TreeViewItem as follows:                                       <ContextMenu ItemsSource="{Binding Commands}"> <ContextMenu.ItemContainerStyle> <Style TargetType="MenuItem"> <Setter Property="Command" Value="{Binding Command}" /> <Setter Property="CommandParameter" Value="{Binding CommandParameter}" /> <Setter Property="Header" Value="{Binding Name}" /> <Setter Property="Icon" Value="{Binding Icon}" /> </Style> </ContextMenu.ItemContainerStyle> </ContextMenu> where Commands is a list of ICommandViewModels objects with the following signature: public interface ICommandViewModel { string Name { get; } Image Icon { get; } ICommand Command { get; set; } object CommandParameter { get; set; } } When the ContextMenu is op

View Complete Post

More Related Resource Links

ASP.NET 4.0 Menu Top Level selected item style


I want to apply a css class to the level 1 menu item (parent) when it or any or it's children are selected.

I've looked at MSDN documentation and any number of examples and walkthroughs but I haven't come up with a way of managing this. I was thinking something like this might work but the style is not being applied to the parent. To further complicate matters, if I try to apply a css style to StaticSelectedStyle it doesn't pick it up at all.

Menu Markup:

<StaticSelectedStyle  Font-Bold="True" ForeColor="#3333CC" />

Code Behind:

        protected void MenuItemClick_NavMenu(Object sender, MenuEventArgs e)


            MenuItem parentItem = e.Item.Parent;

            if (parentItem != null)


                parentItem.Selected = true;



Can I open the "new" menu in a SharePoint Document Library using Dragon NaturallySpeaking?


When a user, who uses Dragon NaturallySpeaking, says "new" when viewing a Document Library the default content type is selected and the associated application (e.g. Microsoft Word) is launched. This scenario is okay for Content Type selection since the Microsoft Office applications will prompt for the metadata once the file is saved.

If the user needs to create new folders in the Document Library however they need to expand the "new" dropdown menu.

What is the best way for someone using Dragon NaturallySpeaking to expand the "new" menu for a Document Library in SharePoint?

Menu doesn't popup when WIndow style set to AllowsTransparency="True" WindowStyle="None"

Hi,I'm facing an issue, when using Window style set to AllowsTransparency="True" WindowStyle="None", my menus in menubar doesn't popup, rather they gets hidden (not visible) and if you just click by guess then menu item will be executed, its just that menu item is not shown visisble.However, if I revert back the Window style to normal without Transparency then menus visible(popup) perfectly.I'm not sure what could be an issue?San

SQL Server Management Stduio 10.0 (SSMS) Window Menu Listing Open Windows


In SSMS for 2008 the windows menu listing of open files is inconsistent.

When only windows that have previously been saved to a file are opened the Window menus lists as follows:
File Name - Connection (Username(spid)) - This is perfect since the file name is at the front and it's easy to identify a window

However, when an unsaved window is open (typically named SQLQueryX.sql) along with these saved windows the Window menu lists as follows:
File Name - Connection (Username(spid)) - Only for the first (active) window
C:\...\Connection (Username(spid)) - For remaining windows - this is annoying since we can't easily identify the windows by file name

Style on asp.menu problem



I'm using the default CSS style (Style.css) that VS2010 creates for and ASP.NET web app and also more or less the default master page (Site.Master).

In Style.css there is a style definied for the active menu item:

div.menu ul li a:active
    background-color: #465c71;
    color: #cfdbe6;
    text-decoration: none;

and this is the code for my menu from Site.Master page:

<div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" 
                    EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" 
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Domov"/>
                        <asp:MenuItem NavigateUrl="~/Stranka.aspx" Text="Stranke"/>
                        <asp:MenuItem NavigateUrl="~/Kontakt.aspx" Text="Kontakti"/>
                        <asp:MenuItem NavigateUrl="~/Polica.aspx" Text="Zavarovalne police"/>
                        <asp:MenuItem NavigateUrl="~/Password.aspx" Tex

Menu control style problem



I can not get the ItemSpacing to work. What is wrong ? -Hope you can help me.

            <asp:Menu ID="Menu1" runat="server" DataSourceID="smdsMaster" MaximumDynamicDisplayLevels="0"
                Orientation="Horizontal" StaticDisplayLevels="2" Width="100%" StaticMenuItemStyle-BorderStyle="Solid"
                StaticMenuItemStyle-BorderColor="Black" StaticMenuItemStyle-BorderWidth="1px">
                <StaticMenuItemStyle BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Font-Bold="true"  
                HorizontalPadding="10px" ItemSpacing="10px" VerticalPadding="5px"  />
            <asp:SiteMapDataSource ID="smdsMaster" runat="server" />


            <asp:Menu ID="Menu1" runat="server" DataSourceID="smdsMaster" MaximumD

MenuItem Click event handler not getting called from a HierarchicalDataTemplate EventSetter Style


I have a user control that contains another user control based on a button. When the button is clicked I have it show a context menu that is bound to a enumeration that shows a dynamic set of menu items. I use a HierarchicalDataTemplate to generate the MenuItems and use a style with an eventsetter to define a menu click handler to be called when any of the menu items are clicked. The context menu and its menu items gets displayed properly but the event handler is not getting called. Any ideas? Below is the section of the xaml where the user control is defined and below it is the code behind with the event handler.



<Controls:WebcastButton x:Uid="videoConfigureButton" x:Name="videoConfigureButton" 

Double click requirement to open menu

Hi, In my application, The main form (having main menu on its top) opens an other form calling .show() method. While the second form(Called via .show() method) is in front of main form, if I click on the menu of Main form it requires 2 click. First to activate the main form and then the second one to open the menu drop down. Is there any way that I could open the menu of main form in the above mentioned scenario in 1 click only. Thanks & Regards, Maverick.

Disabling the "Open with Report Builder" menu item



We are using MOSS 2007 integrated with SQL Reporting Services. In the report viewer, there is a menu item called "Open With Report Builder". We do not want this menu item to be displayed or, alternately, would like to disable it. I assumed that this could be done by configuring the SSRS integration property "Enable ad-hoc reporting" in central admin to FALSE. Alas, this is not the case. The report builder menu item is still there and when you select it, it starts to install the application. How can I either disable or hide this menu item in the report viewer?

Thank You.

SharePoint 2010 - Accordian Style Quick Launch Menu


I am working on Sharepoint 2010. i need to display the Quicklaunch in Accordian style.


i am using the following script to achieve it. it works fine but i need to display plus(+) and minus (-) when it expands & collapse.

<script src="/WebDocuments/jquery-1.4.4.min.js" type="text/ecmascript">

<script type="text/javascript">

$(document).ready(function() {
// do stuff when DOM is ready

function makeLNCollapsible()
function () {
$(">ul", $(this).parent()).show("fast");
function () {
$(">ul", $(this).parent()).hide("fast");


How To Open Fancy Tooltip from GridView

This article will show How To Open show Fancy Tooltip in GridView.

ASP.NET Menu with jQuery Superfish

Choosing the right type of menu for a website is not easy at all. The ASP.NET Menu Control is definitely NOT a good starting point due to the horrendous markup it renders, nor is it good for SEO because of the Markup/Content ratio, neither can it be easily styled.

ASP.NET repeater control - databind with style

even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

Gmail style multiple Sign-in type combo...is it possible in asp.net?


I am developing a multi-company application and want my users to give the functionality like the following to switch companies.


Is this possible? then how?

Please help


Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



MS Word style comments in asp.net



I need to create a system, that will be similar to ms word style comments. So the idea is the following: on the page there are a pack of text boxes labels and so on, and user need have the way to comment each control, and save commented text, for example to DB, so the others can reed comments too.

I tried PopUpControlExtender, but it works in single way, and i cannot view all the popups in one time. Or may be i missed something and there is a way to popup all the controls at one time? 

Therefore, are there any known solutions for a discribed task, based on PopUpControlExtender or something else?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend