c# - How to give an Access key to a button with image on it.? If we press ALT +S then not able fire the click event -
<button margin="0,0,5,0" cursor="hand" tooltip="search" command="{binding searchbutton}" isenabled="{binding elementname=savebutton,path=isenabled, updatesourcetrigger=propertychanged,mode=twoway}"> <i:interaction.triggers> <i:eventtrigger eventname="click" > <cmd:eventtocommand passeventargstocommand="false" command="{binding searchbutton}" /> </i:eventtrigger> </i:interaction.triggers> <button.contenttemplate> <datatemplate> <grid> <label visibility="collapsed">_search</label> <image source="/chkrevacc;component/images/search.png" /> </grid> </datatemplate> </button.contenttemplate> </button>
you can use accesstext element wrap text should have access key specified.
<button margin="0,0,5,0" cursor="hand" tooltip="search" command="{binding searchbutton}" isenabled="{binding elementname=savebutton,path=isenabled, updatesourcetrigger=propertychanged,mode=twoway}"> <i:interaction.triggers> <i:eventtrigger eventname="click" > <cmd:eventtocommand passeventargstocommand="false" command="{binding searchbutton}" /> </i:eventtrigger> </i:interaction.triggers> <button.contenttemplate> <datatemplate> <grid> <accesstext visibility="collapsed">_search</accesstext> <image source="/chkrevacc;component/images/search.png" /> </grid> </datatemplate> </button.contenttemplate> </button>
if doesn't work, may not want set visibility collapsed. instead, make opaque , shorten text
<accesstext opacity="0">_s</accesstext>
this way, button still process text, invisible. not sure if you'll need take last step though.
Comments
Post a Comment