Arup Saha
Arup Saha

Reputation: 538

Starting coordinates (screen pixels) of a control in wp7

I have a stack with three items. The first 2 are of TextBlocks containing multiple lines of text. The third is a scroll viewer (i have specified a fixed height). Now the problem is when the text in the first two text blocks grows... the scroll viewer partly goes out of screen but the content doesn't stay in screen on scrolling (I need to scroll it up and keep holding... otherwise it bounces back.). What I want to do is to get the Row (in pixels) where the scroll view is starting so that i can decide its height programatically that scroll viewer doesn't get out of screen. Please help!

Upvotes: 1

Views: 197

Answers (1)

Paul Diston
Paul Diston

Reputation: 3294

Rather than a StackPanel, you may want to consider using a Grid with Grid Rows defined. An example of this might be :-

<Grid>
<Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="Auto" />
    <RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
            Text="Test 1" />
<TextBlock Grid.Row="1"
            Text="Test 2" />
<ScrollViewer Grid.Row="2" />

Hope this helps.

Paul Diston

Upvotes: 1

Related Questions