c# - Local image URL binding to panorama title -
before marking duplicate, please read whole question & efforts. in app first downloading image & saving in local folder not in isolated storage. trying bind local image url (ms-appdata:///local/53077cab6ed10b742b00000c_cloud.png
) panorama title it's not working. can tell me wrong. given attempts based on past answers.
1:
<phone:panorama title="{binding settings.logo.highresolution, converter={staticresource debugconverter}}"> <phone:panorama.titletemplate> <datatemplate> <grid margin="130,80,0,0"> <image height="200"> <image.source> <bitmapimage urisource="{binding converter={staticresource debugconverter}}" /> </image.source> </image> </grid> </datatemplate> </phone:panorama.titletemplate> </phone:panorama>
2:
<phone:panorama title="{binding settings.logo.highresolution, converter={staticresource debugconverter}}"> <phone:panorama.titletemplate> <datatemplate> <grid margin="130,80,0,0"> <image height="200" source="{binding}"/> </grid> </datatemplate> </phone:panorama.titletemplate> </phone:panorama>
3:
same #1 & #2 without converter.
i used 2 type of conversion none of worked.
public class debugconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { return new uri(value.tostring()); //return new system.windows.media.imaging.bitmapimage(new uri(value.tostring())); } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { throw new notimplementedexception(); } }
try use such converter:
public class debugconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { bitmapimage temp = new bitmapimage(); using (isolatedstoragefile isf = isolatedstoragefile.getuserstoreforapplication()) using (isolatedstoragefilestream file = isf.openfile((string)value, filemode.open, fileaccess.read)) temp.setsource(file); return temp; } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { throw new notimplementedexception(); } }
i haven't tried above code, if image saved isolated storage should work. don't know pass value - should string pointing file "53077cab6ed10b742b00000c_cloud.png" without ms-appdata.
edit - remark
as i've checked file created in localfolder such code (for example):
storagefolder localfolder = applicationdata.current.localfolder; storagefile samplefile = await localfolder.createfileasync("datafile.txt", creationcollisionoption.replaceexisting);
is created in isolatedstorage root folder of app (it created same isolatedstoragefile). files should accessible via isolatedstorage.
Comments
Post a Comment