Responsive UI Tips

后端 未结 3 738
既然无缘
既然无缘 2020-12-23 23:44

I would just like a few tips when i want to create a responsive UI.

I know how to use:

Dispatcher
Task
BackgroundWorker
Threads

I

3条回答
  •  爱一瞬间的悲伤
    2020-12-24 00:35

    1. FastObservableCollection

    2. Manipulating PresentationSource

    3. Using PLinq or Linq on multiple threads by using AsQueryable() for dynamic filtering of data sources than single threaded and thread agnostic CollectionView.

    4. Readymade Gifs over animation

    5. Vitualization of non-virtualized panels like canvas

    6. Deferred scrolling

    7. Trigger.Exnter \ Exit Actions for animations.

    8. BeginStoryboard.HandoffBehavior="Compose"

    9. Using Hardware over software acceleration.

    10. Avoiding WindowStyle=None, AllowTransparency=true, Background=Transparent, TileMode

    11. Configure RenderOptions.BitmpaScalingMode as LowQuality and enable caching. Enable PresentationFontCache windows service.

    12. Use Staticresources over Dynamicresources

    13. Avoid inheritable dependency properties. Also avoid heavy operations in property changed call backs.

    14. Use Freezable brushes. Avoid x:Name / Namescoping / Binding to their Color propertys them to be freezable all the time.

    15. Set background of the border, if it encapsulates a visual than setting visual's background. Similar is if you have set a Brush as background of a visual then specify Brush.Opacity than Visual.Opacity.

    16. Value converters must have minimulistic code. use Binding.IsAsync and PriorityBinding wherever applicable.

    17. Use Expanders with IsExpanded=False by default.

    18. CompositionTarget.Rendering fires on each rendering cycle so should be used only if required. Detatch it on any opportunity.

    19. WPF DataGrid should avoid heavy use of combobox columns and editable Template columns, as the combobx templates try to load selected value and use the display member path by actually searching it from the items source of each combobox and template columns leak when used with highly observable collections.

    20. Use WPF Extedned Tooklit based Shader effects and New Pixel Shader APIs such as Blur, Shadow.

    And Many more...

提交回复
热议问题