Windows Phone 7 - Keyboard showing up for now reason -
so have listbox template in bind observablecollection of objects called "totaldebits".
i have 2 way delete items:
- one 1 through context menu
- by range through delete button , fetching checked objects.
this works:
private void delete_click(object sender, routedeventargs e) { deletedebit((directdebit)(((menuitem)sender).datacontext)); } private void deletedebit(directdebit ddb) { totaldebits.remove(ddb); } private void delete_click(object sender, eventargs e) { deletedebitlist(); } private void deletedebitlist() { try { foreach (var ddb in totaldebits.tolist()) if (ddb.ischecked) totaldebits.remove(ddb); } catch { } }
in both case, items deleted, problem is, in second case, keyboard showing right after items deleted, absolutely no reason.. of course can hide right after focusing on list looks ugly , wish find way prevent issue happening.
edit:
you'll find hereunder xaml of page:
<controls:pivotitem header="direct debit" > <grid> <grid.resources> <storyboard x:name="listboxsizeincrease"> <doubleanimation storyboard.targetname="debitlist" storyboard.targetproperty="height" from="475" to="380" duration="0:0:.5"/> </storyboard> <storyboard x:name="listboxsizedecrease"> <doubleanimation storyboard.targetname="debitlist" storyboard.targetproperty="height" from="380" to="475" duration="0:0:.5"/> </storyboard> </grid.resources> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> <rowdefinition height="*"/> </grid.rowdefinitions> <listbox grid.row="0" x:name="debitlist" height="475" margin="10,5,10,0" tap="listbox_tap" itemssource="{binding totaldebits}" verticalalignment="top" itemcontainerstyle="{staticresource customlistboxitem}"> <listbox.itemtemplate> <datatemplate> <stackpanel margin="0,2,0,2"> <grid margin="5,5,5,5" horizontalalignment="stretch"> <grid.columndefinitions> <columndefinition width="60" /> <columndefinition width="*"/> <columndefinition width="auto"/> </grid.columndefinitions> <checkbox x:name="checkitem" grid.column="0" ischecked="{binding ischecked}" checked="checkitem_checked" unchecked="checkitem_unchecked" /> <textblock x:name="descriptionblock" fontsize="24" grid.column ="1" text="{binding description}" horizontalalignment="left" verticalalignment="center"> </textblock> <textblock fontsize="24" grid.column ="2" text="{binding amount}" textalignment="right" horizontalalignment="right" verticalalignment="center"/> </grid> <toolkit:contextmenuservice.contextmenu> <toolkit:contextmenu name="contextmenu" iszoomenabled="false"> <toolkit:menuitem name="edit" header="edit" click="edit_click"/> <toolkit:menuitem name="delete" header="delete" click="delete_click"/> </toolkit:contextmenu> </toolkit:contextmenuservice.contextmenu> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> <border margin="12,5,12,5" grid.row="1" background="lightgray"/> <grid grid.row="1" margin="14,8,14,8"> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="auto"/> </grid.columndefinitions> <textblock grid.column="0" text="total direct debit" fontsize="28" fontweight="bold" foreground="darkslategray"/> <textblock grid.column="1" x:name="totalblock" text="{binding totalvalue}" fontsize="28" fontweight="bold" foreground="darkslategray"/> </grid> <grid grid.row="2"> <grid.rowdefinitions> <rowdefinition height="auto"/> </grid.rowdefinitions> <border margin="12,5,12,5" background="lightgray"> <grid grid.row="0"> <grid.columndefinitions> <columndefinition width="300"/> <columndefinition width="*"/> </grid.columndefinitions> <stackpanel orientation="vertical" grid.column="0"> <textblock margin="10,0,0,0" text="description" fontsize="20" foreground="darkslategray"/> <textbox x:name="descriptionbox" fontsize="15" /> </stackpanel> <grid grid.column="1"> <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="auto"/> </grid.columndefinitions> <stackpanel orientation="vertical" grid.column="0"> <textblock margin="0,0,0,0" text="amount" foreground="darkslategray"/> <textbox x:name="amountbox" fontsize="15" /> </stackpanel> <stackpanel orientation="vertical" grid.column="1"> <textblock margin="10,0,0,0" text="." foreground="darkslategray"/> <textbox x:name="decimalbox" width="60" fontsize="15" maxlength="2"/> </stackpanel> </grid> </grid> </border> </grid> </grid> </controls:pivotitem>
Comments
Post a Comment