c# - App.xaml.cs UnhandledException when Binding Image URL in Image Source -


i have xaml

(...) <listbox height="auto" margin="0,0,-20,0" x:name="post_images_grid_list" verticalalignment="top" horizontalcontentalignment="stretch" scrollviewer.verticalscrollbarvisibility="disabled" scrollviewer.horizontalscrollbarvisibility="disabled">                             <listbox.itemspanel>                                 <itemspaneltemplate>                                     <toolkit:wrappanel />                                 </itemspaneltemplate>                             </listbox.itemspanel>                             <listbox.itemtemplate>                                 <datatemplate>                                     <grid width="auto" height="auto" background="#ff#247722" margin="0,0,10,20">                                         <grid.columndefinitions>                                             <columndefinition width="19*"/>                                         </grid.columndefinitions>                                         <stackpanel horizontalalignment="left" verticalalignment="top" orientation="horizontal" margin="0">                                             <image source="{binding image, mode=oneway}" width="110" height="110" margin="5" stretch="uniformtofill" verticalalignment="center" horizontalalignment="center"/>                                         </stackpanel>                                     </grid>                                 </datatemplate>                             </listbox.itemtemplate>                         </listbox>  (...) 

and c# code in mypage.xaml.cs:

(...) post_images_grid_list.itemssource = thepost.images; (...) 

the definition of thepost.images:

public list<bitmapimages> images = new list<bitmapimages>(); 

and bitmapimages class:

public class bitmapimages {     public bitmapimage image { get; set; }      public bitmapimages(string image_url)     {         this.image = new bitmapimage(new uri(image_url, urikind.relativeorabsolute));     } } 

but after xaml page display completed, debug jump method application_unhandledexception in app.xaml.cs, problem?

here data of list images @ run time:

data of list

everything looks right me! each url exists , has image, checked in web browser.

i appreciate help, have no idea what's going on!.

thank you,rohit vats, here e.exception:

  • e.exceptionobject {ms.internal.wrappedexception: error hresult e_fail has been returned call com component. ---> system.exception: error hresult e_fail has been returned call com component. @ ms.internal.xcpimports.checkhresult(uint32 hr) @ ms.internal.xcpimports.uielement_measure(uielement element, size availablesize) @ system.windows.uielement.measure(size availablesize) @ microsoft.phone.controls.wrappanel.measureoverride(size constraint) @ system.windows.frameworkelement.measureoverride(intptr nativetarget, double inwidth, double inheight, double& outwidth, double& outheight) --- end of inner exception stack trace ---} system.exception {ms.internal.wrappedexception}

it seems has size of xaml image element?

ok, feel stupid:

<grid width="auto" height="auto" background="#ff#247722" (...) /> 

copypaste error here:

<grid width="auto" height="auto" background="#ff247722" (...) /> 

thank help.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -