积极答复者
XAML设计

问题
答案
-
1. 做背景,我们只需要将图片设置为顶层Grid 的Bakcground 就可以了,通过ImageBrush 来实现:
<Page.Resources> <ImageBrush x:Key="bg" ImageSource="Assets/xxxx.png"/> </Page.Resources> <Grid Background="{StaticResource bg}" PointerPressed="Grid_PointerPressed"> <!-- controls --> </Grid>
然后在Grid上实现Pointer事件来导航,控件就可以放置在Grid中
2. 因为Grid默认会将内部元素填充,所以我们还可以将Image第一个放置在Grid中,其他控件放置在后面,这样Image就在底层,作为背景。
<Grid PointerPressed="Grid_PointerPressed"> <Image Source="Assets/Logo.png" Stretch="Fill"/> <!-- controls --> </Grid>
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已标记为答案 panfanglin 2012年10月4日 4:59
-
嗯,谢谢您百忙之中来指点。嗯,我是初学。实现是实现了,1,但我要手势向右滑就能转到第二张图片,请问我要怎么实现呢。2如何设置指定的页面作为启动项呢。
- 已标记为答案 panfanglin 2012年10月4日 4:59
全部回复
-
1. 做背景,我们只需要将图片设置为顶层Grid 的Bakcground 就可以了,通过ImageBrush 来实现:
<Page.Resources> <ImageBrush x:Key="bg" ImageSource="Assets/xxxx.png"/> </Page.Resources> <Grid Background="{StaticResource bg}" PointerPressed="Grid_PointerPressed"> <!-- controls --> </Grid>
然后在Grid上实现Pointer事件来导航,控件就可以放置在Grid中
2. 因为Grid默认会将内部元素填充,所以我们还可以将Image第一个放置在Grid中,其他控件放置在后面,这样Image就在底层,作为背景。
<Grid PointerPressed="Grid_PointerPressed"> <Image Source="Assets/Logo.png" Stretch="Fill"/> <!-- controls --> </Grid>
Bob Bao [MSFT]
MSDN Community Support | Feedback to us
- 已标记为答案 panfanglin 2012年10月4日 4:59
-
嗯,谢谢您百忙之中来指点。嗯,我是初学。实现是实现了,1,但我要手势向右滑就能转到第二张图片,请问我要怎么实现呢。2如何设置指定的页面作为启动项呢。
- 已标记为答案 panfanglin 2012年10月4日 4:59
-
1, 那你就可以用FlipView 来承载图片:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> <FlipView> <FlipViewItem> <Image Source="Assets/XXX1.png"/> </FlipViewItem> <FlipViewItem> <Image Source="Assets/XXX2.png"/> </FlipViewItem> <FlipViewItem> <Image Source="Assets/XXX3.png"/> </FlipViewItem> </FlipView> </Grid>
2, 打开 App.xaml.cs 修改 OnLaunched 方法中的 rootFrame.Navigate(typeof(MainPage), args.Arguments) 中的 typeof() 里面的type为你的页面类型即可。
Bob Bao [MSFT]
MSDN Community Support | Feedback to us