c# - On double click change the name of checkbox present in listbox as item template WPF -


i have bound listbox checkbox in it.

now have change name of checkbox on double clicking on it.

how can change name of checkbox (i have give option user change name of checkbox means user double click on name of checkbox name replaced textbox user can add name . on blur or suitable event saved database)

 <listbox alternationcount="2"   width="140" margin="18,63,480,24" name="lstbxcuisines" itemssource="{binding}" >      <listbox.itemtemplate>         <datatemplate>             <checkbox  name="chkcuisine" height="20"  margin="0,5,0,0" fontsize="12" tag="{binding cuisineid}" content="{binding cuisine}"/>         </datatemplate>     </listbox.itemtemplate>     <listbox.resources>         <style  targettype="{x:type listboxitem}">             <style.triggers>                 <trigger property="itemscontrol.alternationindex" value="0">                     <setter property="background" value="#ffffff"></setter>                 </trigger>                 <trigger property="itemscontrol.alternationindex" value="1">                     <setter property="background" value="#f1f6fe"></setter>                 </trigger>             </style.triggers>         </style>     </listbox.resources> </listbox> 

you add mousedoubleclick-event combobox:

            <datatemplate>                 <checkbox name="chkcuisine" height="20"  margin="0,5,0,0" fontsize="12" tag="{binding cuisineid}" content="{binding cuisine}" mousedoubleclick="chkcuisine_mousedoubleclick"/>             </datatemplate> 

in eventhandler, can change name so:

    private void chkcuisine_mousedoubleclick(object sender, mousebuttoneventargs e)     {         ((combobox)sender).name = "newname";     } 

Comments