wpf - Why MenuItem doesn't send specified parameters but Button send -


<menuitem command="local:commandlibrary.registerservicecommand">     <menuitem.commandparameter>         <multibinding converter="{staticresource traywindowviewmodelconverterresource}">             <multibinding.bindings>                 <binding elementname="me" />                 <binding fallbackvalue="parser" />             </multibinding.bindings>         </multibinding>     </menuitem.commandparameter> </menuitem>  public class traywindowviewmodelconverter : imultivalueconverter {     public object convert(object[] values, type targettype, object parameter, cultureinfo culture) {         var viewmodel = new window1viewmodel();          foreach (var obj in values) {             if (obj window)                 viewmodel.caller = obj window;             else if (obj string)                 viewmodel.servicename = obj.tostring();         }          return viewmodel;     }      public object[] convertback(object value, type[] targettypes, object parameter, cultureinfo culture) {         throw new notimplementedexception();     } } 

button cammand same menuitem. when debug converter menuitem, values parameter contains 2 object: dependencyproperty.unsetvalue (i'm not aware what's this) , mycontextmenu object.

and how can pass sometype parameter? thanks

menuitems exist in popups outside main visual tree , don't have same name scope surrounding elements, button. when trying bind, elementname binding can't resolve because "me" element outside menuitem's name scope.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -