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

Read a textblock with zero size

4 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mostafa
Top achievements
Rank 2
Mostafa asked on 21 Sep 2012, 03:46 PM

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

4 Answers, 1 is accepted

Sort by
0
Mostafa
Top achievements
Rank 2
answered on 25 Sep 2012, 02:10 PM
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

0
Plamen
Telerik team
answered on 26 Sep 2012, 08:04 AM
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
0
Mostafa
Top achievements
Rank 2
answered on 28 Sep 2012, 12:58 PM
thanks for the solution, it worked ;)
0
Plamen
Telerik team
answered on 28 Sep 2012, 01:00 PM
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
Tags
General Discussions
Asked by
Mostafa
Top achievements
Rank 2
Answers by
Mostafa
Top achievements
Rank 2
Plamen
Telerik team
Share this question
or