Monday, 15 September 2014

c# - MS.Internal.WrappedException in .itemsSource -



c# - MS.Internal.WrappedException in <Pivot>.itemsSource -

i trying utilize pivot view image. when run code, debugger breaks @ line:

mainviewer.itemssource = queueingimages;

and thrown weird exception:

an exception of type 'ms.internal.wrappedexception' occurred in system.windows.ni.dll , wasn't handled before managed/native boundary

this xaml used:

<phone:pivot grid.row="1" name="mainviewer"> <phone:pivot.headertemplate> <datatemplate> <textblock text="" fontsize="0" /> </datatemplate> </phone:pivot.headertemplate> <phone:pivot.itemtemplate> <datatemplate> <grid> <grid.rowdefinitions> <rowdefinition height="*" /> <rowdefinition height="10" /> </grid.rowdefinitions> <image source="{binding imgsource}" stretch="uniform" grid.row="0"> <toolkit:gestureservice.gesturelistener> <toolkit:gesturelistener flick="{binding imageflick}" dragdelta="{binding imagepan}" pinchdelta="{binding imagezoom}" tap="{binding imagetap}" doubletap="{binding imagedoubletap}" /> </toolkit:gestureservice.gesturelistener> </image> <progressbar grid.row="1" value="{binding downloadpercentage}" maximum="100" minimum="0" smallchange="1" visibility="{binding iscompleted}"/> </grid> </datatemplate> </phone:pivot.itemtemplate> </phone:pivot>

the "queueingimages" is:

private observablecollection<imageview> queueingimages

here imageview class:

class imageview { public imageview(string id) { id = id; } public string id { get; private set; } public imagesource imgsource { get; private set; } public int downloadpercentage { get; set; } public visibility iscompleted { get; set; } public event eventhandler flicked; /* flick="{binding imageflick}" dragdelta="{binding imagepan}" pinchdelta="{binding imagezoom}" tap="{binding imagetap}" doubletap="{binding imagedoubletap}" */ public void setsource(system.io.stream s) { bitmapimage bi = new bitmapimage(); bi.setsource(s); imgsource = bi; } public void progresshandler(object sender, downloadprogresschangedeventargs e) { downloadpercentage = e.progresspercentage; } /////// image controls public void imageflick(object sender, flickgestureeventargs e) { // pass out event if (flicked != null) flicked(sender, e); } public void imagepan(object sender, dragdeltagestureeventargs e) { system.diagnostics.debug.writeline("panning"); } public void imagezoom(object sender, pinchgestureeventargs e) { system.diagnostics.debug.writeline("zooming"); } public void imagetap(object sender, gestureeventargs e) { system.diagnostics.debug.writeline("tapped"); } public void imagedoubletap(object sender, gestureeventargs e) { system.diagnostics.debug.writeline("double tapped"); } }

can point out doing wrong?

alright, figured out. error caused next code.

<toolkit:gestureservice.gesturelistener> <toolkit:gesturelistener flick="{binding imageflick}" dragdelta="{binding imagepan}" pinchdelta="{binding imagezoom}" tap="{binding imagetap}" doubletap="{binding imagedoubletap}" /> </toolkit:gestureservice.gesturelistener>

it seems cannot utilize binding under toolkit:gesturelistener. remove bindings , everything's working perfectly:)

c# xaml windows-phone-8

No comments:

Post a Comment