New User?   Join Now     Login            Forgot Password?    
XamlQuery v1.2
Frequenty Asked Questions
Posted on Sep-14-2010 (4614 hits)
  1. Why Search() method requires a reference control as argument?

    The reference control is used to limit the search scope. The search scope is very important, because of Silverlight's behavior of creating additional controls in the rendered output. The lesser the search scope, the higher the accuracy of matching. For example, if the user needs to find controls inside a Grid, the reference control shall be that Grid instead of root control in the Page/UserControl.

  2. Can we use any number of white-spaces inside a query string?

    Yes, there is no restriction in number of white-spaces in a selector. Also, a selector can span to multiple lines. However, the whitespace between two simple-selectors is a combinator for descendant-selector.

  3. Is "*.GreenRect" and "* .GreenRect" are different?

    Yes, white-space is a symbol used for descendant selectors. '*.GreenRect' will match all controls with style 'GreenRect'. '* .GreenRect' will match all controls with 'GreenRect' that are descendants of some other control in the rendered output.

  4. Should dependency property names end with 'Property'?

    No, the 'Property' keyword should be ignored while using a dependency property in a selector. For example, UIElement.OpacityProperty should be given as 'UIElement_Opacity'.

  5. While using style selectors, styles should be defined in the same UserControl/Page?

    No, styles can reside in same UserControl/Page or any of merged resource dictionaries or App.xaml also. XamlQuery will search for styles in all these places.

  6. While using style selectors, using a base style will match controls of its dependent styles?

    Yes, using a base style in selector will match controls whose style is extended from that basestyle. For example, if style 'GreenRect' and 'BlueRect' are based on style 'BaseRect', then the selector query '*.BaseRect' will match both green and blue rectangles.

  7. Is type selectors can be used to find subclasses of a control type?

    Yes, type-selectors match controls of sub classes also. For example, the selector query 'Shape' will match controls of type Rectangle, Line, Ellipse, etc. Similarly, the selector query 'Selector' will match controls of type ComboBox, ListBox, etc.

About      Terms      Contact