Mimal99
UI is lagging while scrolling a listView
Also something like this: System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=MatchList'. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'Grid' (Name=''); target property is 'Width' (type 'Double')
51 replies
UI is lagging while scrolling a listView
When Im scrolling, Im getting some error messages in output console. Maybe it will help. System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=itemsImages[6]; DataItem=null; target element is 'ImageBrush' (HashCode=3730161); target property is 'ImageSource' (type 'ImageSource')
51 replies
UI is lagging while scrolling a listView
But then it will work like async binding, but will show temporary image instead of blank space. When all the bindings was async, scrolling was still laggy and images were loading one by one (that looks not so good)
51 replies
UI is lagging while scrolling a listView
Is that what you had in mind?
https://www.youtube.com/watch?v=fBKW-spQboc
51 replies
UI is lagging while scrolling a listView
Hmm, I think only with Async Bindings, but then its "lazy load". When Im scrolling there are a lot of empty spaces etc. for a couple of seconds. I don't know why ListView cant somehow "remember" all the records instead of rendering them every time
51 replies
UI is lagging while scrolling a listView
Kinda, I have added stopwatches to my whole API class, so it's write elapsed time to console, but I can't add a stopwatch to XAML code. C# part stores the data in objects, it takes about 30 second to prepare, but its fine. XAML loads this data by <Image source="{Binding imageProperty}"/> and the only tool I have is PerformanceProfiler, but it's not so helpful. I can send you the results, but I don't understand how it works so
51 replies
UI is lagging while scrolling a listView
Now its maybe a little bit faster, but still laggy. Here is the method:
private static readonly ObjectCache memoryCache = MemoryCache.Default;
public static BitmapImage GetImageFromFile(string path, string fileName)
{
if (memoryCache.Contains(fileName) && memoryCache[fileName] is BitmapImage cachedImage)
{
return cachedImage;
}
string tempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
string finalPath = Path.Combine(tempPath, fileName);
var image = new BitmapImage(new Uri(finalPath, UriKind.Absolute))
{
DecodePixelHeight = 35,
DecodePixelWidth = 35,
CacheOption = BitmapCacheOption.OnLoad
};
image.Freeze();
memoryCache.Set(fileName, image, new CacheItemPolicy
{
AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(30)
});
return image;
}
51 replies