wpf - Show default local image while url image is loading -


i wpf newbie. in wpf app, have images load web. avoid gui blocking, followed approach mentioned in how can keep wpf image blocking if imagesource references unreachable url?

works great. issue is, until image loads, gui doesn't honor dimensions properties set in image node. end result kind of 'resize' affect - gui(elements) of 1 size , 'readjust' once image loaded.

i wish make load 'smooth'. want able specify 'initial default' image. initial image in wpf image control

however not able work. may below in imageasynchelper(which wrong) :

    public static readonly dependencyproperty sourceuriproperty = dependencyproperty.registerattached("sourceuri", typeof(uri), typeof(imageasynchelper), new propertymetadata     {         propertychangedcallback = (obj,e) =>         {             ((image)obj).setbinding(image.sourceproperty,                 new binding("defaulturi")                 {                     source = new uri("pack://application:,,,/blah/images/default.gif", urikind.relativeorabsolute)                 });          }          propertychangedcallback += (obj, e) =>         {             ((image)obj).setbinding(image.sourceproperty,               new binding("verifieduri")               {                   source = new imageasynchelper { givenuri = (uri)e.newvalue },                   isasync = true,               });         }     }); 

what options?

try setting image elements minwidth , maxwidth desired size.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -