Mimal99
Mimal99
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
I guess if nothing else works, I'll have to do as you say
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
I don't know if it's important, but it only appears when scrolling
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
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
CC#
Created by Mimal99 on 11/17/2023 in #help
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
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
I have tried CollectionView and it helped a little bit maybe. When im scrolling just in the middle it works a bit smoother, but when i scroll down to end its the same
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
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
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
Hmm, I can try, but I've never used it before
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
Is that what you had in mind? https://www.youtube.com/watch?v=fBKW-spQboc
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
Yeah I saw this, but can't find a way to use it in WPF sadly. Im trying to find something similar
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
I think it doesn't support WPF or I'm too stupid to use it
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
Without the scrollviever it works the same. Ill try this package
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
Hmm, so how to disable scrollviewer? Also in my <Page ../> I have RenderOptions.BitmapScalingMode="HighQuality" line, so it works for whole content
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
But Im beginner in wpf, so maybe there is another way
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
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
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
By default I display the main part - 22 images. In each record there is a button that shows the details, and here is the rest
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
35x35, they are small, but i need ~140 images per record...
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
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
CC#
Created by Mimal99 on 11/17/2023 in #help
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
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
In a while I will try to modify my method to use IMemoryCache and see if that helps
51 replies
CC#
Created by Mimal99 on 11/17/2023 in #help
UI is lagging while scrolling a listView
System.InvalidOperationException: 'To modify a specific value of type 'System.Windows.Media.Imaging.BitmapImage', set the IsFrozen attribute to 'false'.' With ScrollViewer.CanContentScroll="False" it works same as before
51 replies