WPF UI multitasking

前端 未结 2 594
慢半拍i
慢半拍i 2020-11-30 04:27

I\'m creating some UI programmatically which involves some heavy processing. Basically what i want is to run a loader animation while my UI is being built/added to the windo

2条回答
  •  爱一瞬间的悲伤
    2020-11-30 04:51

    I don't see any heavy work there, aside from maybe loading images.

    Ideally, you should create all of the UI elements (border/grid/etc) on the ui thread, and only do the image loading in another thread.

    Or better yet, instead of creating all that UI programmatically, you should be using some form of ItemsControl and DataTemplate to generate all the ui, and load all of your images async in some kind of view model like thing.

提交回复
热议问题