Read a textblock with zero size

5 posts, 0 answers
  1. Mostafa
    Mostafa avatar
    22 posts
    Member since:
    Aug 2012

    Posted 21 Sep 2012 Link to this post

    Hi Telerik Team,
    I am facing problems with a zero sized textblock.

    I used this, because Telerik Test Studio can't see the properties of my UserControl.
    So I put a zero sized textblock directly under this UserControl.  (See Screenshot 1 & WPF-Code).

                   
    <StackPanel Grid.Column="1" Grid.RowSpan="2">

                 <ToggleButton x:Name="PlayButton"

                                  Margin="3,0,0,0"

                                  Content="{StaticResource PlayShape}"

                                  HorizontalAlignment="Center"

                                  VerticalAlignment="Top"

                                  Foreground="#FFFFFFFF"

                                  Style="{StaticResource CJ_ToggleButtonStyle}"

                                  RenderTransformOrigin="1.053,0.985"

                                  Height="50"

                                  Width="80"

                                  ToolTipService.ToolTip="{Binding Path=LanguageResources.Play_Pause, Source={StaticResource Localizer}}"/>

                        <TextBlock x:Name="QAPlayerTimeCode" Width="0" Height="0" ></TextBlock>

                    </StackPanel>

    I try to add this Control over the DOM Control (because I can't see it). But when I do this, a second project is created (!). (See Screenshot 2).

    And during runtime I get an exception, because appIndex  is "-1".

    ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl plugin = Get<ArtOfTest.WebAii.Controls.HtmlControls.HtmlControl>("tagname=object", "type=~application/x-silverlight");
    int appIndex = plugin.OwnerBrowser.GetSilverlightAppIndex(plugin);

    How can I access this control?
    If it is visible (hight and width over 1px) a can add and access it. But I need to use "hidden" Controls.

    Greetings
    Mostafa

  2. Mostafa
    Mostafa avatar
    22 posts
    Member since:
    Aug 2012

    Posted 25 Sep 2012 Link to this post

    I think that the solution with the Zero Sized TextBox is not a practicable way ... if I imagine that we had in the whole application hundreds of these invisible text boxes......

    Therefore I would like to ask, what do we need to do? so that we can retrieve public properties of non-Telerik-user controls??  (eg through implementation of specific interfaces or similar).
    do you have any suggestions??

    Best regards,
    Mostafa

  3. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 26 Sep 2012 Link to this post

    Hi Mostafa,

    In order to use the properties of your custom user control, you can create a Wrapper class for that control. Take a look at this thread from our Code Library section. You'll also find a sample project attached to the second post. 

    Please give it a try and let me know if you need further assistance on this.

    Kind regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  4. Mostafa
    Mostafa avatar
    22 posts
    Member since:
    Aug 2012

    Posted 28 Sep 2012 Link to this post

    thanks for the solution, it worked ;)
  5. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 28 Sep 2012 Link to this post

    Hi Mostafa,

    Glad to hear it! Thanks for the update.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top