wpf - How to customize default context menu -



wpf - How to customize default context menu -

in wpf application want create textboxes cut, re-create , paste restricted. 1 way set contextmenu ="{x:null}"

but doing loose spell check suggestions don't want loose. in application have 1000 textboxes want in more optimize way.

any advice appreciated.

if need menu items related spell checking, can refer msdn article: how to: utilize spell checking context menu.

if want apply custom contextmenu multiple (but not all) textboxes:

<window.resources> <contextmenu x:key="mycustomcontextmenu"> <menuitem header="ignore all" command="editingcommands.ignorespellingerror" /> </contextmenu> </window.resources> <grid> <textbox height="23" name="textbox1" width="120" spellcheck.isenabled="true" contextmenu="{staticresource mycustomcontextmenu}" /> </grid>

if want apply custom contextmenu all textboxes:

<window.resources> <style targettype="{x:type textbox}"> <setter property="contextmenu"> <setter.value> <contextmenu> <menuitem header="ignore all" command="editingcommands.ignorespellingerror" /> </contextmenu> </setter.value> </setter> </style> </window.resources> <grid> <textbox height="23" name="textbox1" width="120" spellcheck.isenabled="true" /> </grid>

note:

you can move context menu resource application level instead of window level. the msdn article mentions menu items via c# code , not via xaml. port "ignore all" command xaml (code snippets above), spelling suggestions, have r&d.

wpf wpf-controls contextmenu

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -