![](/img/trans.png)
[英]How do you find the screen position of a control in silverlight on WP7?
[英]How to always position a control to a fixed location on screen in silverlight on wp7?
無論客戶端將焦點更改為哪個文本框,如何始終將Silverlight控件放置在屏幕上的同一位置? 基本上,我有一個標題橫幅,希望一直可見。 當客戶端將焦點更改為文本框時,我希望滾動所有內容以使文本框進入中心視圖(這是默認行為),但橫幅始終應顯示在(0,0)屏幕坐標處。 到目前為止,我的布局是:
<Grid x:Name="LayoutRoot"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Name="myBanner"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Height="80"
Width="480" />
<TextBox Grid.Row="2"
Name="textBox1"
Text="TextBox"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Height="72"
Width="480"
/> <--- Even when client focuses on this I want myBanner to be visible at (0,0) screen coordinate
</Grid>
在手機上的短信應用程序中可以看到一個示例。 無論客戶是否專注於在文本框中編寫文本消息,標題“ John Doe,Text”頂部的標題始終都顯示在同一位置。
再次感謝任何幫助。
嘗試這個
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<!-- Your banner goes here-->
<TextBlock Text="some text" />
<ScrollViewer Grid.Row="1">
<!-- Your content goes here-->
</ScrollViewer>
</Grid>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.