i got strange black magic going on app.
i have defined imagebrush in style dictionary:
<classes:multiresimagechooser x:key="multiresimagechooser"/> <imagebrush x:name="splashscreenimagebrush" imagesource="{binding splashscreenresolutionimage, source={staticresource multiresimagechooser}}" stretch="fill" />`
the multiresimagechooser class has 1 simple property:
public class multiresimagechooser { public bitmapimage splashscreenresolutionimage { { switch (resolutionhelper.currentresolution) { case resolutions.hd720p: return new bitmapimage(new uri("/images/splashscreenimage.screen-720p.jpg", urikind.relative)); case resolutions.wxga: return new bitmapimage(new uri("/images/splashscreenimage.screen-wxga.jpg", urikind.relative)); case resolutions.wvga: return new bitmapimage(new uri("/images/splashscreenimage.screen-wvga.jpg", urikind.relative)); default: throw new invalidoperationexception("unknown resolution type"); } } } }
splashscreenimagebrush binded background property of border element:
<border x:name="splashscreen" background="{staticresource splashscreenimagebrush}" horizontalalignment="stretch" verticalalignment="stretch" />
so, problem when debug application on wp8 emulator or wp8 device works fine. when launching app without debugging, border background property rendered white. image files included in project , have build action set content.
also, if set imagesource directly image path, works.
so, problem seems multiresimagechooser, not know wrong it.
any kind of or hints appreciated.
btw, issue not reproduced on w wp7.1 device , emulator.
my bet: resolutionhelper.currentresolution
doesn't work reason (timing issue?), "default" branch of switch executed. binding therefore fails, brush doesn't initialized, , white color instead. there, i'd start confirming execution of "default" branch, instance putting specific image instead of throwing exception. then, if theory right, resolutionhelper
understand what's going on.
Comments
Post a Comment