.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

Mouse Right Click Disabling in grid row

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :WPF


   Can one tell me how to disable Mouse rigth click in Grid row,please tell me how to handle it in xaml.

Thanks  in Advance

View Complete Post

More Related Resource Links

Context Menu And Mouse Click Issue

Hello. I am trying to show a context menu at runtime on MouseRightButtonUp, while over a selected image. I also have left mouse button events set up for the selected image. For some reason I cannot get the context menu to show unless I click the left mouse button and while it is held down click the right mouse button and keep it down while I release the left mouse button, followed by releasing the right mouse button. I tested the MouseRightButtonUp event using a simple MessageBox and did not have any problems; it worked as expected when the right mouse button was released. Here is the code: //add behavior for right mouse on this image. img.MouseRightButtonUp += (sender, e) => { //Create Context Menu ContextMenu menu = new ContextMenu(); //img is an Image img.ContextMenu = menu; //Add context menu item MenuItem photoNewWindow = new MenuItem(); photoNewWindow.Header = "Open Original Image"; photoNewWindow.Click += OpenOriginal; //Add menu items to context menu menu.Items.Add(photoNewWindow); //change the current image currentImage = img; }; // add behavior for mouse click on this image. img.MouseLeftButtonUp += (sender, e) => { // left mouse stuff }; Thanks! 

mouse click event

there are many control lack this mouseclick event, though they have the mousedoubleclick. in this scenario: i click on obj1, holding the click, move it to obj2 and release the click you see here obj1 is mouse-down, but mouse-up is obj2 so, do you count there's a mouse click event happened here? if you count it, which object will you consider should receive the mouse click? or is there a better way/algorithm to handle this mouse click? in my view, there's no mouse click happen, unless the down and up are happened on same obj.

Open ContextMenuStrip on left mouse click on NotifyIcon

Hi,I was working with an application and faced this problem, I have this code :public partial class Form2 : Form    {        public Form2()        {            InitializeComponent();        }        private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)        {            if (e.Button == MouseButtons.Left)            {                contextMenuStrip1.Show(this, Control.MousePosition); // Or any other overload            }        }        private void Form2_Load(object sender, EventArgs e)        {            notifyIcon1.Icon = Icon;        }    }Here, in design mode, i have set contextMenuStrip1 as notifyIcon1's ContextMenuStrip. When I right click on notifyIcon1, it opens the context menu and when I click somewhere else, it closes. But with my code opens the contextmenu on left click and when I open context menu that way, it shows in taskbar and doesn't close when I click some where else.In short, I want to open contextmenustrip when user left clicks and right clicks on the notifyicon and it works well with right click by default but not with left click. And I want to avoid using SendMessage to send left click message.Is there any way I can work this out?

Populate Grid/Listbox depending on the click of checkbox of treeviewitem of treeview in wpf

Hi, I am using your TreeViewWithCheckBoxes example (http://www.codeproject.com/KB/WPF/TreeViewWithCheckBoxes.aspx) in my code. on the basis of checked state in treeview I have to populate a grid. How to go about that. Ex: If Suppose Root Child1 Child1.1 Child1.2 Child2 Child2.1 Child3 Child3.1 Child3.2 is the treeview with checkboxes, and I check, Child1.1 or Root(all treeviewitems selected) node then I have to populate a grid/listbox on the selection basis. Thanks, Manu G

Implement Mouse Click event in AxShockWaveFlash

Hi, I want to hide the AxShockWaveFlash control when I clck on it. public class myAxShockwaveFlash: AxShockwaveFlashObjects.AxShockwaveFlash { private const int WM_LBUTTONDOWN = 0x0201; protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_LBUTTONDOWN: { Visible = false; // I also tried SetVisibleCore(false); } break; } base.WndProc(ref m); } } There are no errors while debugging. Unfortunatelly the AxShockWaveFlash doesn't disappear. If I use methods instead that are defined direct in AxShockWaveFlash (like Play(), Stop(),...), the source code will work. Why does it not work?

OpenDialog box to open file with a double-mouse click

Hi, I am having a hard time trying to find an example that opens an opendialog box and allows the users to open the file with a Double-Click. Please help.   Thanks

Activity/State mouse double click

Hi, When I double click activity/state, the workflow designer sets that activity/state as root designer. Is there a way to  disable this behavior? Thank you

Suppress mouse click event following LostFocus


I have a Canvas which handles mouse click events. When the mouse is clicked it will pop up a TextBox at the position of the click. The TextBox subscribes to the LostFocus event and will make itself disappear when this event is fired.

What happens is: the user clicks, text box appears, user types, user clicks outside textbox (to finish the text entry process), the text box disappears, a new text box appears at the position of the click.

What I would like to happen: when the user clicks outside of the text box I would to suppress the click event so that the text box disappears and a new one does not appear.

Many thanks,


GridView and mouse double click Response.Redirect problem


VS 2005, AJAX 

I use gridview and I need single and double click for each row in gridview.

When I click once on a row, some action will execute (e.g. next button should be enabled) and when I double click the row there should be redirection to another page.

I used the code below for both single and double click  usage:


protected void GwContainers_RowDataBound(object sender, GridViewRowEventArgs e)
                if (e.Row.RowType == DataControlRowType.DataRow)
                    // Get the LinkButton control in the first cell

                    LinkButton singleClickButton = (LinkButton)e.Row.Cells[8].Controls[0];
                    // Get the javascript which is assigned to this LinkButton


Datagrid + Mouse right click event


I have a datagrid and it contains the list of files from the folder. I want to display the default window files right click options in right click on the filename.

That is when ever i right click the filename in the datagrid, a default windows right click pop up should appear.


Can anyone help me to sort this out. The project is in C#.

Thank you.

Saugat K.C.

WorkflowDesigner.Load causes Grid resizing mouse cursor to stop working.


Hi all,

We have a problem where WorklowDesigner.Load() causes the WPF Grid control's resizing mouse cursor not to come up. I have demo app written if anyone wants to double check. http://cid-467e12cdf12776bc.office.live.com/self.aspx/.Public/WpfApplication6.zip


If you just run the demo, you will see the resize cursor will work when you hover over the red grid splitters. However if you go into the wfusercontrol2 control and uncomment this line //wf.Load(new System.Activities.Statements.Flowchart()); , then run the application again you will notice the resize cursor does not show up when hovering over the  grid splitter.


It seems as though under the hood somewhere this exception occurs: Could not load file or assembly 'System.Activities.Presentation.Aero, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Isenabled property in WPF not working on mouse right click



   I set Isenabled =false on a paticular condition using trigger evry thing got disabled but mouse right click is working and Getting selected,can any one let me know how to resolve this issue.


Thanks in Advance

Disable Mouse Right click in datagrid


Hi Friends,

       Can any one Suggest,how to disable mouse right click in WPF Datagrid.


Thanks in Advance,


How can I do virtual mouse click?


Hi all,

I have to do a virtual click on any position on window(I mean click by not use a mouse  ). How can I do that in C#?

Thank a lot.

How to select all rows in grid from a click event?



I'm using the code below to select multiple rows in a gridview using a checkbox, how do I modify the code in a "select all" button click event to select all the rows by checking the checkboxes in all the rows? How do I also clear all the checkboxes using sa "Clear" button click event?

<asp:GridView ID="GridView2" runat="server" Height="211px" Width="16px">


<asp:TemplateField HeaderText="SomeText" >


<asp:CheckBox ID="CheckBox1" runat="server" Text="" />





Thank You.


Right Mouse Click


I am working on a website that draws fractals on the screen. It was my intention that with a right mouse click the picture could be saved to the visitor's computer. But that I get an error message "filetype blocked".

The file is called test.jpg and is drawn to the screen as a bitmap. Could anybody tell me how to 'unblock' the right mouse click so that a visitor can save a picture he or she likes?

Maybe it would be possible to let people download the image? But how would that work?


(near) realtime measurement of mouse click intervals

I'm writing a application[net/wpf/c#] that is supposed to measure how fast an user clicks (responds) after hearing a word. Its called a Auditory Processing Speed Test (PST) and the average human speed is around 70-140ms. To get an idea of the precision of time intervals of mouse events generated, I wrote the following.

namespace WpfApplication1

    public partial class MainWindow : Window
        [DllImport("winmm.dll", EntryPoint = "timeBeginPeriod")]
        public static extern uint MM_BeginPeriod (uint uMilliseconds);

        [DllImport("winmm.dll", EntryPoint = "timeEndPeriod")]
        public static extern uint MM_EndPeriod (uint uMilliseconds);

        System.Diagnostics.Stopwatch w = new System.Diagnostics.Stopwatch();

        public MainWindow ()
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