Elad Yehuda
Member
- Joined
- Jul 3, 2023
- Messages
- 10
- Programming Experience
- 3-5
Hello everyone!
I have an annoying problem, I have a UserControl that contains a list of questionnaires, each questionnaire contains several questions, and the answers themselves are questions are actually a collection of images that are dynamically built in the code behind, that is, I run on a BitmapImage dictionary
whose value is the BitmapImage of the image itself and the key is the name of the image itself. I wrap the image itself in a Border and then insert the Border into the UnifromGrid (I have a reason not to use with ItemsControl even though it's super useful). Now in the main window I add this UserControl and embed it in one TabItem out of 3 in the TabControl, the problem is this, the UserControl itself contains a property that binds with some property from the MainWindow, this property takes care of running a function that should fill the -UnifromGrid in images, this means that as soon as the window comes up, the images actually appear on the UnifromGrid, now when I click on its TabItem there is a 2 second delay that just causes the program to freeze, this means that I can't have focus on any other control in the window And I have to wait, first question why this delay is created while this TabItem is in focus for the first time during the program
(although after that if I exit this window and restart it this delay won't repeat itself even though I reupload the images again)? And this despite the fact that when the window is loaded, the images are already on the UnifromGrid!
The second question is how can this be overcome?
It is important for me to note that when loading the program while still in the App, I turn to the function that fills in the images for me in a dictionary that saves the images as a BitmapImage variable and for each image I perform optimization with a decoding function.
Another important thing to note is that I only upload 24 images in total.
Thanks to the respondents!
I have an annoying problem, I have a UserControl that contains a list of questionnaires, each questionnaire contains several questions, and the answers themselves are questions are actually a collection of images that are dynamically built in the code behind, that is, I run on a BitmapImage dictionary
whose value is the BitmapImage of the image itself and the key is the name of the image itself. I wrap the image itself in a Border and then insert the Border into the UnifromGrid (I have a reason not to use with ItemsControl even though it's super useful). Now in the main window I add this UserControl and embed it in one TabItem out of 3 in the TabControl, the problem is this, the UserControl itself contains a property that binds with some property from the MainWindow, this property takes care of running a function that should fill the -UnifromGrid in images, this means that as soon as the window comes up, the images actually appear on the UnifromGrid, now when I click on its TabItem there is a 2 second delay that just causes the program to freeze, this means that I can't have focus on any other control in the window And I have to wait, first question why this delay is created while this TabItem is in focus for the first time during the program
(although after that if I exit this window and restart it this delay won't repeat itself even though I reupload the images again)? And this despite the fact that when the window is loaded, the images are already on the UnifromGrid!
The second question is how can this be overcome?
It is important for me to note that when loading the program while still in the App, I turn to the function that fills in the images for me in a dictionary that saves the images as a BitmapImage variable and for each image I perform optimization with a decoding function.
Another important thing to note is that I only upload 24 images in total.
Thanks to the respondents!