惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
GbyAI
GbyAI
月光博客
月光博客
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
F
Full Disclosure
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
博客园 - Franky
V
V2EX
Recorded Future
Recorded Future
WordPress大学
WordPress大学
小众软件
小众软件
Webroot Blog
Webroot Blog
雷峰网
雷峰网
Vercel News
Vercel News
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
K
Kaspersky official blog
F
Fortinet All Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Spread Privacy
Spread Privacy
博客园 - 叶小钗
罗磊的独立博客
D
Docker
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Register - Security
The Register - Security
A
About on SuperTechFans
B
Blog RSS Feed
I
InfoQ
T
Tailwind CSS Blog
G
Google Developers Blog
H
Help Net Security
V
Vulnerabilities – Threatpost
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
M
MIT News - Artificial intelligence
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
MyScale Blog
MyScale Blog
Latest news
Latest news

博客园 - Peter Wang

SharePoint 备忘录 查找ContentType的依赖项 Different users – Calendar Audience Targeting Guide SharePoint 2010 Audit log report SharePoint workspace 2010同步功能 SharePoint 2010 bug sharepoint 引用不起作用 整合Bing Maps DotNet软件测试实战技术 VSTS 架构版share 敏捷开发中的项目管理利器-Mingle Castle揭密2----IOC(1) Castle揭密2----IOC(3) Castle揭密2----IOC(2) Castle揭密1--前言 概念回顾--MDA 概念回顾---中间件(IDC) 实现Web Service依赖倒置 SQL Server 索引结构及其使用(四) SQL Server 索引结构及其使用(三)
silverlight performance tip
Peter Wang · 2009-08-31 · via 博客园 - Peter Wang

原文:http://www.ganshani.com/2009/07/10/silverlight-2-best-practices-iii/

Locally defined StaticResource fails to load

When a StaticResource object is both defined and referenced inside the same element, the Preview Window will fail to load with an error “The type StaticResource was not found.” 

Hence, it is advisable to keep Static Resources in App.xaml file. This also helps usage of these resources across the modules in the application.

Share a Brush than copying it

Instead of defining Brush in XAML, define it as StaticResouce and reference it. This creates only one instance and then reuses it.

Generic TODO list:

This is more of a compilation of single-liners that aptly fit in the TODO list of a Silverlight developer.

-          Naming Convention – Casing:
Pascal Casing and not Camel Casing is preferred (unlike in C#).  myButton is wrong in Silverlight though it is correct in C#. The correct version is MyButton.

-          Use x:Name instead of Name as x:Name is generic and can be used for all elements.

-          Indentation:
Place first attribute in-line with the element name like.
<StackPanel
    DockPanel.Dock=”Top” Orientation=”Horizontal”>

-          Choose a StaticResource over DynamicResource. For further read, click here

-          Resources should be placed at one location, preferably at Application Level in App.xaml file. This will avoid reloading of resources over and again when objects are created and destroyed.

-          SnapsToDevicePixels – Using graphic objects can appear nice on some monitors, while it may fade on others.  It is preferred to use a Style resource in such scenarios. For more read, click here

-          Define a definite folder structure before starting application development

·         Services – to have WCF service references

·         Images – to store application images and videos

·         Resources – platform specific APIs

·         Data – to store XML, text files

-          Remove the Object Handlers when not in use.  Not removing object handlers may keep the object alive, which may degrade the performance

-          RegisterClassHandler is called on every instance of object creation, which may cause performance problems

-          Frozen objects over Non-frozen:
Frozen objects occupy lesser memory space and are fast in execution. Consider the example on
MSDN

-          Prefer VirtualizingStackPanel (40mSec) over a simple StackPanel (takes 3000mSec for same UI) to speed up the execution time.

-          Avoid using a TextBlock in FlowDocument

-          Since Label.Content property is slow in execution, TextBlock.Text should be used. (This is one reason why Label is not a part of Silverlight framework, and it is part of WPF)

-          Show underline in Hyperlink only on MouseOver events.  TextDecoration is performance intensive.

-          Bind an IList to an object, not an IEnumerable to avoid an automatic wrapper creation.  This will enhance your performance.

-          Proper node at proper place:
While the tree is developed, there can be two approaches – bottom-up or top-down. A top-down approach is 10 times faster. This is because when a node is added or removed from the logical tree, property invalidations are raised on the node’s parent and all its children
.