Forum Discussion

harriet_louis's avatar
harriet_louis
Occasional Contributor
12 years ago

How do I find a property, when I have created a custom control?

Is there someway how I can make a treeview dump of the properties when I creat3e a property checkpoint? 



I know the value of the property, and will  be able to search for it if I can make a text dump of the all the properties available on this object. In my case, I have used an image and then manipulate it via xaml in order to behave like a button. 



The property that I am interested in specifically is the image displayed.



I know this is vague, but hopefully someone will be able to assist?

Thank you.

10 Replies

  • harriet_louis's avatar
    harriet_louis
    Occasional Contributor
    OK this is really important to me to find the property and its value at run time. 

    Please could you have a look?



    The c#, xaml definition of my custom button (an image that is clickable, and changes according to state):




    <!-- KeepDeleteButton -->


                <Button x:Name="KeepDeleteImage" Style="{StaticResource ButtonStyle4}"  Command="{Binding KeepDeleteButtonClickedCommand}"


                                Width="17" Height="17" Margin="201,0,0,90" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Column="1" />


     


     


    ...


    <Style x:Key="ButtonStyle4" TargetType="{x:Type Button}">


                <Setter Property="Template">


                    <Setter.Value>


                        <ControlTemplate TargetType="{x:Type Button}">


                            <Grid>


                                <Image>


                                    <Image.ToolTip>


                                        <MultiBinding Converter="{StaticResource KeepDeleteImageTooltipConverter}">


                                            <Binding Path="CallModel.KeepDeleteStatus"/>


                                            <Binding Path="CallModel"/>


                                        </MultiBinding>


                                        


                                    </Image.ToolTip>


                                    <Image.Source>


                                        <MultiBinding Converter="{StaticResource KeepDeleteImageConverter}">


                                            <Binding Path="CallModel.KeepDeleteStatus"/>


                                            <Binding Path="CallModel"/>


                                        </MultiBinding>


                                    </Image.Source>


                                </Image>  


                            </Grid>


                            <ControlTemplate.Triggers>


                                <Trigger Property="IsFocused" Value="True"/>


                                <Trigger Property="IsDefaulted" Value="True"/>


     


                                <Trigger Property="IsMouseOver" Value="True">


                                    <Setter Property="RenderTransform" >


                                        <Setter.Value>


                                            <ScaleTransform ScaleX="1.1" ScaleY="1.1" />


                                        </Setter.Value>


                                    </Setter>


                                </Trigger>


     


                                <Trigger Property="IsPressed" Value="True">


                                    <Setter Property="RenderTransform" >


                                        <Setter.Value>


                                            <ScaleTransform ScaleX=".95" ScaleY=".95" />


                                        </Setter.Value>


                                    </Setter>


                                </Trigger>


     


                                <Trigger Property="IsEnabled" Value="False"/>


                            </ControlTemplate.Triggers>


                        </ControlTemplate>


                    </Setter.Value>


                </Setter>


            </Style>

  • harriet_louis's avatar
    harriet_louis
    Occasional Contributor
    Hello Tanya, I have tried this, but still could not find the property. 



    Is there a way to make a text dump of the properties with their respective values, in order to check whether the property lies somewhere I failed to check?



    Thanks for your reply.
  • harriet_louis's avatar
    harriet_louis
    Occasional Contributor
    hi, I did have a look at the object browser, and it sees the objects until this level:

    Aliases["ImplementationLayer"]["HwndSource_AppEntrypoint"]["AppEntrypoint"]["Grid"]["placeholder"]["MainViewControl"]["Grid"]["Grid"]["groupBox1"]["Grid"]["WPFObject"]("StopStartRecordingImage")["Style"]["Setters"]



    ------ note, according to the xaml definition, this is what i think it should be, and from this point forward, in the object browser, i do not see any familiar fields.



    Please help, kinda desperate here...

  • Hi Harriet,


     


    It looks like you need to work with this object:


    Aliases["ImplementationLayer"]["HwndSource_AppEntrypoint"]["AppEntrypoint"]["Grid"]["placeholder"]["MainViewControl"]["Grid"]["Grid"]["groupBox1"]["Grid"]


     


    You can create a snapshot of this object and analyze its properties/fields/methods later. Please refer to the "Creating Snapshots in Object Browser" article for details.


     

  • harriet_louis's avatar
    harriet_louis
    Occasional Contributor
    Hi.



    I have tried making a snapshot and then looking at it, but I still cannot find the property I am looking for. The object url that you sent me, doesn't help much, as I do see al my objects in the grid, but I am looking for the image source of in particular of that button definition I posted before. 



    Is there some cases in which TestComplete will not be able to make sensible mappings?



    I really like the product, but if it cannot do this, then I will probably have to try something else. 
    • yurik's avatar
      yurik
      Contributor

      Hi,

        I need to find a name of an image inside a Rectangle (System.Windows.Shapes.Rectangle).

        When I check this element with Snoop, I can see the Fill element with the image name and when I delve into the Fill, I can see the x:Key with the value of the image name (PSA screenshots).

        However in TestComplete Object Browser I cannot see Key property (see the third screenshot) even after ticking "Show hidden members" option. Is there any way of accessing this property in TestComplete?

       

      Thanks!

      • aalikhalid's avatar
        aalikhalid
        Contributor

        Hi Yurik,

         

        In my experience sometimes certain properties are not readable by TestComplete, or not read as it is, some information is parsed. Therefore if the property is not being shown in the 'advanced view' in object spy, then the property would not be usable within TestComplete.

         

        I think there might be other properties which have the image name in them, I'd recommend to go through the complete list of properties in object spy's advanced view.

         

        - Ali

        Happy Automating!