views:

193

answers:

2

Is there a way to determine the size and position of the visible area of a control in Silverlight, when the control is somewhere in a scroll viewer?

I have a control that is inside a grid at some Row and Column. The grid is inside a scroll viewer. The scroll viewer has fixed width and height. The grid's width and height are greater that those of the scroll viewer. At some point my control is only partially visible because of the scrolling.

I have a rectangle in a popup that I need to place above my control, when the mouse is over it. I need to make the rectangle size to be exactly as the visible part of my control.

How can I do that?

Thanks.

A: 

Have you checked to see if scroll viewer is setting a clipping path on your Grid?

D.R. Payne
If you referr to calling method LayoutInformation.GetLayoutClip(gridName), the the answer is no. The method call returns NULL.
Ciprian Bortos
A: 

I don't think so.... here is a part of the code in the page using the control

<ScrollViewer x:Name="ScrollHor" VerticalScrollBarVisibility="Auto" Margin="17 215 0 0" Height="100"  Grid.Row="1" Grid.Column="1">
    <StackPanel Height="Auto">
        <Grid x:Name="grdTimeline">
             <!-- Used to add dynamically controls-->
        </Grid>
    </StackPanel>
</ScrollViewer>

and what look the xaml of the control

        <Grid x:Name="LayoutRoot" MouseLeftButtonUp="LayoutRoot_MouseLeftButtonUp">

            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="labelColumn" Width="100" />
                <ColumnDefinition x:Name="mainColumn" Width="auto" />
                <ColumnDefinition x:Name="buttonColumn" Width="30" />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition x:Name="rowHeader"  Height="30"/>
                <RowDefinition x:Name="businessRow" Height="Auto"/>
            </Grid.RowDefinitions>
 .....

        </Grid>

Thanksfor answer and best regards,

n.chappuis
I'm accepting this answer since I could not find a way of doing what I am asking above.
Ciprian Bortos