![](/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.