UQuery provides a set of extension methods for retrieving elements from a visual tree. UQuery is based on JQuery or Linq, but UQuery is designed to limit dynamic memory allocation as much as possible. This allows for optimal performance on mobile platforms.
要使用 UQuery 来检索元素,请使用 UQueryExtensions.Q
,或使用 UQueryExtensions.Query
来初始化 QueryBuilder
。
例如,以下 UQuery 从根开始查找名为 foo
的第一个 Button
:
root.Query<Button>("foo").First();
以下 UQuery 在同一个组中名为 foo
的每个 Button
上进行迭代:
root.Query("foo").Children<Button>().ForEach(//执行操作);