Sends for the fellow dear visitors:welcome to dongpad!


 Welcome to DongPad!

 msn


x:Name vs. x:Key

Question

When should I use x:Key and when should I use x:Name when creating elements?

Answer

It depends on where you create your element.
x:Key is only valid in the scope of a ResourceDictionary element. x:Key is used as the primary identifier for elements in the ResourceDictionary. Specifying x:Name is not considered valid (it will cause an exception when accessing resources).
On the other hand, x:Name is valid in the scope of everything but a ResourceDictionary. x:Key is not valid outside the ResourceDictionary scope.

Btw, lazy for update the blog due to my busy work ,enjoy~~hoho



评论: 0 | 引用: 0 | 查看次数: 928 | 返回顶部
发表评论
昵 称:    
验证码:   
 
内 容:
选 项:  
 
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 500 字 | UBB代码 开启 | [img]标签 开启