Find cell in RadGridview silverlight

4 posts, 0 answers
  1. ivan
    ivan avatar
    8 posts
    Member since:
    Nov 2010

    Posted 11 Mar 2011 Link to this post

    I want to find is there cell with searched content. From silverlight application I select table and put it to Element Explorer with name GrdRadgridview.
    Then I try to find cell with
        <CodedStep("Find In DataGrid", RequiresSilverlight:=True)> _
        Public Sub FindInRow()
            Dim app As SilverlightApp = ActiveBrowser.SilverlightApps()(0)
            app.VisualTree.Refresh()
            Dim FindCell As DataGridCell = Pages.UIManagerCMXaml.SilverlightApp.GrdRadgridview.Find.ByExpression(New XamlFindExpression("TextContent=TEST")).[As](Of DataGridCell)()
        End Sub

    but got message
    The control type 'ArtOfTest.WebAii.Silverlight.UI.DataGridCell' does not match the xaml tag 'textblock'

    even if there is cell with searched value.

    Ivan
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 18 Mar 2011 Link to this post

    Hi Ivan,
        you seem to be trying to convert a TextBlock element to a DataGridCell element.

    This is the statement in question:
    Find.ByExpression(New XamlFindExpression("TextContent=TEST")).[As](Of DataGridCell)
    This part returns an element:
    Find.ByExpression(New XamlFindExpression("TextContent=TEST"))
    and then this part tries to convert it to DataGridCell:
    .[As](Of DataGridCell)

    However, you can't turn just any element into a DataGridCell. In this instance
    Find.ByExpression(New XamlFindExpression("TextContent=TEST"))
    seems to be returning a TextBlock.

    Please make sure
    Find.ByExpression(New XamlFindExpression("TextContent=TEST"))
    returns what you intended it to return (and that should be something convertable to DataGridCell). If you do want it to return a TextBlock then what you're trying to do simply can't be done.

    I hope this helps, let me know how it goes!

    Best wishes,
    Stoich
    the Telerik team
  3. ivan
    ivan avatar
    8 posts
    Member since:
    Nov 2010

    Posted 18 Mar 2011 Link to this post

    Thanks Stoich,

    I manage to find searched text content from data cells, and as I understood it, it should always be textblock.
    I was trying to make dataGridcell or dataGridrow object with XamlFindExpression but with to success. Only object I can create is textbock and for now, this is enough. It seems that I do not understand format of XamlFindExpression that shold be correct for converting it in cell or row object.

    Best regards

    Ivan
  4. Stoich
    Admin
    Stoich avatar
    1 posts
Back to Top