开发者

X:uid in silverlight

what is the use of X:Uid attribute in s开发者_如何学编程ilverlight controls


x:Uid is ignored by the Silverlight runtime, it is there for WPF compatibility and to ease sharing of XAML and tools between the two runtimes.


As a practical example, we have used x:Uid for UI automation purposes.

Tools like UISpy see what you stuff in the value of the x:Uid attribute ... as the AutomationID property. See this MSDN article for more info. In other words, it identifies the controls that you wish to automate/test and allows you to actually do that automation/testing.

In fact, the above is the only reason we have ever used this attribute.

Now, in my case, I am talking about the WPF applications I've worked on, and I can see from your question that you are asking about the Silverlight controls. Maybe Silverlight doesn't (yet) have a way to automate/test the controls in the same manner ... in that case, Austin Lamb's answer makes a lot of sense. Many things are done in Silverlight that don't have any apparent purpose ... other than for compatibility reasons (so you have less work to do when making controls that work on both platforms).


x:Uid Directive

Provides a unique identifier for markup elements. In many scenarios, this unique identifier is used by XAML localization processes and tools.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜