WPF Image UriSource, Data Binding and Caching?

I can't tell from your code what is going on, but I would use Snoop to drill down into it and see what is going on. You should be able to see any binding errors and see what the DataContext is on the Image and make sure the ThumbFile property on your DataContext has what you'd expect.

Up vote 3 down vote favorite share g+ share fb share tw.

I have this currently working for a databound WPF image: Simple Enough. Now, adding caching to this Image (I want to be able to manipulate/remove the local file after it has been loaded). I found that you can add a CacheOption="OnLoad" to the tag within the .

Then I had to have a converter to translate the local file to the BitmapImage. And public class LocalUriToImageConverter : System.Windows.Data. IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.

CultureInfo culture) { if (value == null) { return null; } if (value is string) { value = new Uri((string)value); } if (value is Uri) { System.Windows.Media.Imaging. BitmapImage bi = new System.Windows.Media.Imaging.BitmapImage(); bi.BeginInit(); //bi. DecodePixelWidth = 80; bi.

DecodePixelHeight = 60; bi. UriSource = (Uri)value; bi.EndInit(); return bi; } return null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization. CultureInfo culture) { throw new Exception("The method or operation is not implemented.

"); } } For some reason this doesn't even begin to work. There are no errors but the control does not seem to be bound. Breakpoints in both the get of the ThumbFile property and the Converter do not get reached, even though the control has many instances created.

Switching back to the other Image Source tag works fine. .net wpf xaml data-binding link|improve this question asked Nov 10 '11 at 20:47elbweb1318 88% accept rate.

Failed bindings, etc...? – Aaron McIver Nov 10 '11 at 20:54 Nothing at all. There were a lot of different errors I went through trying to get to the point that it worked, but then it finally stopped erroring while still not actually working. – elbweb Nov 10 '11 at 21:36.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions