Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

.net - Invoke a ContextMenu to open -


i need google maps (but in wpf):

  • when rightclick on map have contextmenu.
  • when rightdoubleclicking have unzoom action.

so, apparently, little difficult in wpf... after struggling , searching lot, read people compains "we can't predict future" (i ask myself how google predict it), decided "wait" systeminformation.doubleclicktime , display contextmenu.

surely, not ideal, human-observable, don't know other method.

so, problem have following code (i have custom canvas):

contextmenueventargs lastcontextmenueventargs = null; bool? lastcontextmenueventargshandled = null;  protected override void oncontextmenuopening(contextmenueventargs e) {     lastcontextmenueventargs = e;     lastcontextmenueventargshandled = e.handled;      e.handled = true;     //base.oncontextmenuopening(e); }  bool rightmouseclickedonce = false; protected override void onpreviewmouserightbuttonup(mousebuttoneventargs e) {     //base.onpreviewmouserightbuttonup(e);      console.writeline(">>>>>>>>>>> onpreviewmouserightbuttonup");     if (!rightmouseclickedonce)     {         rightmouseclickedonce = true;         thread thread = new thread(             new system.threading.threadstart(                 delegate()                 {                     thread.sleep(system.windows.forms.systeminformation.doubleclicktime);                     this.dispatcher.invoke(                         system.windows.threading.dispatcherpriority.background,                         new action(                             delegate()                             {                                 if (rightmouseclickedonce)                                 {                                     console.writeline(">>>>>>>>>>> right click");                                     rightmouseclickedonce = false;                                     base.onpreviewmouserightbuttonup(e);                                      if (lastcontextmenueventargshandled.hasvalue)                                     {                                         console.writeline(">>>>>>>>>>> lastcontextmenueventargshandled");                                         lastcontextmenueventargs.handled = lastcontextmenueventargshandled.value;                                         base.oncontextmenuopening(lastcontextmenueventargs);                                         lastcontextmenueventargshandled = null;                                     }                                     //if (this.contextmenu != null)                                     //{                                     //  this.contextmenu.placementtarget = this;                                     //  this.contextmenu.isopen = true;                                     //}                                 }                             }                     ));                 }         ));         thread.start();     }     else if (rightmouseclickedonce)     {         console.writeline(">>>>>>>>>>> right double click");         rightmouseclickedonce = false;         base.onpreviewmouserightbuttonup(e);         this.onmouserightdoubleclick(e);     }  } 

everything works great little problem: base.oncontextmenuopening(lastcontextmenueventargs); not seem work...

i set before

if (this.contextmenu != null) {   this.contextmenu.placementtarget = this;   this.contextmenu.isopen = true; } 

and worked, blocks child contextmenu elements opening, , open parent (canvas) contextmenu.

can invoke contextmenu event?

i don't know wpf, can show menu, say, pixel away cursor , see if user right-clicks again in same spot , in system double click time? i've used similar technique once in game , performed nice enough.
menu "fade in" (optionally, out, too) animation make better.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -