Hello,
I'm Building a dynamic MenuBarItem in the StartUp operation, so it will be built when application finishes
starting up…
But it takes about 3-4 secs to be opened for the first time
Does it have a problem with me, or it's a performance issue in BarItems…?
and if it's, does it have a solution or a work around way?
Thanks in advance
Manar
Hi Manar,
I'm afraid the issue you're experiencing isn't quite clear. Would you please clarify exactly which operation takes 3-4 seconds and how you're building a bar item. It would be really helpful, if you could provide us with a sample project reproducing the issue.
Hi Ted,
Thanks for your reply.
I attached the two functions i used in the Run time to create a Menu Item in the ToolBar called Scripts,
According to the time, I mean that when I click the Script BarItem, or any subitem it takes 3-4 secs to show the SubItems it has, and it depends on how many subitem this menu contains…
Thanks
I have reviewed the code snippets you sent to us, but the issue hasn't become more clear. I have tried to replicate the issue with adding BarButtonItems to BarSubItem, but haven't encountered any problem. Attached is a sample project illustrating my attempt. Please modify it to reproduce the issue you're experiencing and send it back to us.
Hi Ted,
Sorry for being late,
I have modified the giving example, and here is the attached folders, I have attached your example with my modifications, and the folder that it works on,
The folder has python dymmy files, put it anywhere you want, \
and modify the ScriptPath in the Code to ScriptFolder location…
Thanks a lot
here is the script files
Hi Manar,
Thank you for your project. I have reviewed and tested it on my side. Sub-menus were generated fast both for version 11.2 and 11.1. I have attached a video that demonstrates how your application works on my side.
The performance issues can be caused by UIAutomation. Applications that use UIAutomation (e.g., Abbyy Lingvo) can definitely decrease performance of WPF applications. When enabled, the UIAutomation system handles a lot of events, whose amount is proportional to the capacity of the visual tree. This is the main cause of the performance decrease. Version v.11.2 provides a ClearAutomationEventsHelper class, which allows clearing UIAutomation events. The ClearAutomationEventsHelper.ClearAutomationEvents method should be called each time the visual tree has been changed. I have modified your project to demonstrate this approach in action. I call ClearAutomationEventsHelper.ClearAutomationEvents when the MeasureOverride function of the MainWindow is being executed. It may also be better to call this function during the layout update.
We look forward to your feedback once you have had the opportunity to review the sample project.
Thank you.