This is a migrated thread and some comments may be shown as answers.

Find cell in RadGridview silverlight

3 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ivan
Top achievements
Rank 1
ivan asked on 11 Mar 2011, 12:50 PM
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

3 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 18 Mar 2011, 10:24 AM
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
0
ivan
Top achievements
Rank 1
answered on 18 Mar 2011, 10:48 AM
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
0
Stoich
Telerik team
answered on 24 Mar 2011, 01:41 PM
Tags
General Discussions
Asked by
ivan
Top achievements
Rank 1
Answers by
Stoich
Telerik team
ivan
Top achievements
Rank 1
Share this question
or