question

RodAtWork avatar image
0 Votes"
RodAtWork asked ·

Additional question about a user control loading more than once

Earlier I asked why a datagrid was causing the window to load more than once. I got the answer, and thank you for your responses!

However, in a strange coincidence, the release version of the app still exhibits the same behavior. Although it does look somewhat different. It does flash up twice, but not quite in the same way. Now it's faster, but still discernible. Anyway, I took the information I learned from asking here and related in the answer to the above link and implemented it in the custom user control. (I didn't know when I first asked my question here until I saw the response on the Stack Overflow post, that the issue was a custom user control in a tab control.)

Here's where it gets tricky. I've built the project on my dev machine and tested it. There's no flashing at all. I can't see it when I'm debugging it in Visual Studio. And I cannot see a flashing (double loading) when I run the app from the bin\Debug folder on my machine.

But if I run the release version (we're using ClickOnce deployment) I do see the flashing/loading of the custom control with the datagrid in it.

So the thought occurred to me that maybe it has something to do with the build environment? I'm using VS 2019 on my dev box. But our TFS build agent uses VS 2015. Could that be what's resulting in the different behavior?

wpf
· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, in your example, you use ViewPort_SelectionChanged and ViewIndex. Improper programming can result in circular processes with the undesirable effects. I recommend using MVVM exclusively and not using event SelectionChanged. In the ViewIndex property you can call the functions that are now called in ViewPort_SelectionChanged. Multiple calls can be prevented.

1 Vote 1 · ·
RodAtWork avatar image RodAtWork PeterFleischer-3316 ·

I'll try that. Unfortunately, I work with colleagues who like both software patterns in there at the same time i.e.: when I remove the duplicate code, they'll go back in and put it back in.

0 Votes 0 · ·

Hi, as long as your colleagues insert inappropriate code, the problem will remain. I can not help you.

1 Vote 1 · ·

0 Answers