New User?   Join Now     Login            Forgot Password?    
XamlQuery v1.2
About XamlQuery
Posted on Aug-08-2010 (17391 hits)

What is XamlQuery?

XamlQuery is a lightweight yet powerful library that enables rapid web development in Silverlight. It simplifies several tasks like page/document traversing; finding controls by name, type, style, property value or position in control tree; event handling; animating and much more. In short, what XamlQuery aims to do to Silverlight is similar to what jQuery does to JavaScript.

XamlQuery: The Write Less, Do More, Silverlight Library.

XamlQuery selectors are feature rich and similar to CSS (cascading style sheet) selectors and jQuery selectors. The controls can be found very easily using simple to complex selector queries or managed helper methods. Also, XamlQuery provides a powerful API that simplifies complex operations on found controls. Most of the API functions can be invoked in a single line of code. For example, the following code hides all rectanges in a canvas with animation.


The latest stable release of XamlQuery is version 1.2 and can be downloaded from CodePlex.

Why XamlQuery?

  • Unlike other markup languages (like HTML) the controls tree structure in the rendered Silverlight output is different from markup declarations (XAML). The controls cannot be found by directly manipulating the XAML markup tree, because Silverlight creates many additional intermediate controls in the rendered output.

  • Silverlight provides LogicalTreeHelper and VisualTreeHelper helper classes in order to find the controls in a rendered Silverlight page. But, these classes are mostly useful to find the immediate parents and children only.

  • The XamlQuery works for all controls in Silverlight, not only for container controls like Grid and Panel; because even primitive controls like ContentControl can contain any other control like Grid, TreeView inside their templates (data-templates and control-templates).

  • XamlQuery hides the complexity of finding controls using styles that are defined elsewhere, like merged resource dictionaries or application XAML markup (App.xaml).

  • The controls of specific type or a range of types (using base class) can be found easily by the use of type-selectors. For example, using Shape as a type-selector will return all shape based controls like Rectangle, Line, Ellipse, etc.

About      Terms      Contact