RadGridView & RadMenu UI Automation

3 posts, 1 answers
  1. Joe
    Joe avatar
    2 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    Hello again,

    I'm working with RadGridViews this time and I'm having trouble searching/iterating through them.
    What I want to do is to find a row in the grid where a specific field's text matches a specific string, and right clicks to open a menu.
    Here's the xaml for reference.  Attached is a picture of me right-clicking on a row where meter name = "freepadthai"
    <telerik:RadGridView Grid.Row="3" Margin="15,15,15,0" Name="meterGrid" VerticalAlignment="Top" HorizontalAlignment="Left" IsReadOnly="True" Opacity="100" RowIndicatorVisibility="Collapsed" Grid.Column="0" Grid.ColumnSpan="3"
        AutoGenerateColumns="False" SelectionMode="Single" telerik:StyleManager.Theme="Office_Blue" Height="250" RowActivated="meterGrid_RowActivated" >
     
        <!--Fade In Animaiton-->
    <!--<telerik:RadGridView.Resources>
    <Storyboard x:Name="_animationGridLoad">
    <DoubleAnimation Storyboard.TargetName="meterGrid" Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:2" AutoReverse="false" />
    </Storyboard>
    </telerik:RadGridView.Resources>-->
     
    <!--Right Click Context Menu-->
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu ItemClick="RadContextMenu_ItemClick">                
            <telerik:RadContextMenu.Items>
                <telerik:RadMenuItem Header="Create New Meter" CommandParameter="Create" />
                <telerik:RadMenuItem Header="Edit Meter Details" CommandParameter="Edit" />
                <telerik:RadMenuItem Header="Delete Meter" CommandParameter="Delete" />
                <telerik:RadMenuItem Header="View on Map" CommandParameter="View" />
                <telerik:RadMenuItem Header="View Meter History" CommandParameter="History" />
                <telerik:RadMenuItem Header="View Documents" CommandParameter="DocLibrary" />
            </telerik:RadContextMenu.Items>
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
     
    <!--Display Columns-->
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Width="*" Header="Meter Name" DataMemberBinding="{Binding MeterName}"  />
        <telerik:GridViewDataColumn Width="*" Header="Manufacturer" DataMemberBinding="{Binding MainManufacturer}"  />
        <telerik:GridViewDataColumn Width="*" Header="M.C. Approval" DataMemberBinding="{Binding MainMCApprovalNum}" />
        <telerik:GridViewDataColumn Width="*" Header="CT Ratio" DataMemberBinding="{Binding CTRatio}" />
        <telerik:GridViewDataColumn Width="*" Header="Meter ID" DataMemberBinding="{Binding MeterID}" />
    </telerik:RadGridView.Columns>
     
    </telerik:RadGridView>
  2. Answer
    Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 03 Jul 2012 Link to this post

    Hello Joe,

    We have several code sample articles on Silverlight RadGridView, such as this one that demonstrates going through each cell in each row. You'll essentially use a foreach loop to go through each row, and a nested foreach loop to go through each cell in each row.

    You'll have to implement code on what to do when a match is found, and logic for what to do when a match isn't found.

    You can right click by Invoking a Mouse Action, then click the desired RadMenuItem within the RadMenu. As an alternative, you can use Blind Key Presses to invoke the Down and Enter keys.

    Kind regards,
    Anthony
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Joe
    Joe avatar
    2 posts
    Member since:
    Jun 2012

    Posted 04 Jul 2012 Link to this post

    Thanks, that helped me a lot.
Back to Top