none
我的项目是WINDOWS 8,使用VS2012进行编译,进行的是Grid App.请问如何在GroupedItemsPage.xaml和ItemDetailPage.xaml以及GroupDetailPage.xaml中使用不同的背景图片。方法是什么,求大神解答!!! RRS feed

答案

  • Hi

    第一组代码是放在GroupedItemsPage.xaml,你应该看到该页面上有一段代码:

    <Grid Style="{StaticResource LayoutRootStyle}">

    你将它替换成第一组代码。

    然后第二组代码是上面Grid控件的一个loaded事件,你应该将该事件的处理代码放在MainPage class的里面,该方法是MianPage class的一个方法。


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • 已标记为答案 (C)sharp.sq 2013年12月18日 14:54
    2013年12月16日 9:37
    版主

全部回复

  • Hi,

    您首先可以将三幅背景图片放在项目文件夹Assets里面,假设三幅背景图片分别是Image1.png,Image2.png,Image3.png.
    对于GroupedItemsPage页面,您可以找到这段代码定义的Grid:

    <Grid Style="{StaticResource LayoutRootStyle}">

    您可以定义Grid的BackGround,将上述代码修改如下:

     <Grid Style="{StaticResource LayoutRootStyle}">
            <Grid.Background>
                <ImageBrush ImageSource="Assets/Image1.png"/>
            </Grid.Background>

    其他页面的修改类似。

    祝您好运!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    2013年12月13日 1:54
    版主
  • 谢谢您!如果我想在这三张图片上实现一个过渡变换,请问可否实现?当我在GroupedItemsPage上点击Item项进行跳转时,背景的变换可否实现一个渐隐效果?
    2013年12月13日 6:18
  • Hi,

    你可以实现在进入一个页面的时候背景图片逐渐显现。

    参考下面代码:

    <Grid
            Style="{StaticResource LayoutRootStyle}"
            DataContext="{Binding Group}"
            d:DataContext="{Binding AllGroups[0], Source={d:DesignInstance Type=data:SampleDataSource, IsDesignTimeCreatable=True}}" Name="LayoutRoot" Loaded="LayoutRoot_Loaded">
            <Grid.Resources>
                
                <Storyboard x:Name="fadeInStoryBoard">
                    <DoubleAnimation
                        Storyboard.TargetName="LayoutRoot"
                        Storyboard.TargetProperty="Opacity"
                        From="0" To="1.0" Duration="0:0:10"/>
                </Storyboard>
            </Grid.Resources>
      private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
            {
                ImageBrush image = new ImageBrush();
                image.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/Logo.png"));
                LayoutRoot.Background = image;
                fadeInStoryBoard.Begin();
            }



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2013年12月13日 8:56
    版主
  • 非常抱歉,但是还是要问您,您提供的第一组代码和第二组代码应该放到哪个位置中??我的项目是Grid App.非常感谢您!!现在很迫切知道这两组代码的使用方法,能不能告诉我应该在哪里使用?
    2013年12月14日 9:00
  • Hi

    第一组代码是放在GroupedItemsPage.xaml,你应该看到该页面上有一段代码:

    <Grid Style="{StaticResource LayoutRootStyle}">

    你将它替换成第一组代码。

    然后第二组代码是上面Grid控件的一个loaded事件,你应该将该事件的处理代码放在MainPage class的里面,该方法是MianPage class的一个方法。


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • 已标记为答案 (C)sharp.sq 2013年12月18日 14:54
    2013年12月16日 9:37
    版主