locked
Background image is fixed RRS feed

  • Question

  • Hello,
    I have a problem, I have a page with a background image, my problem is that the background image does not move when I do a horizontal scroll on the page.
    I am using C # and xaml

    Rui Peres - C# Fã

    Sunday, December 8, 2013 7:19 PM

All replies

  • Hi Rui,

    I'll move this to a more appropriate forum for you. The UI Design for Windows Store apps forum is for discussion of UI design, not for questions about implementing the app.

    To scroll your background image you will need to put the image inside your ScrollViewer (or other scrolling control). The root of the page itself doesn't scroll. If you need more details you'll need to provide more information about how exactly your page is set up. Showing minimal Xaml that demonstrates how your app is using it would help.

    --Rob

    Sunday, December 8, 2013 7:40 PM
    Moderator
  • The code of my page.

    <Page
        x:Name="pageRoot"
        x:Class="App1.HubPage1"
        DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App1"
        xmlns:common="using:App1.Common"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Background="{StaticResource GrayBackgroundApp}">
    
        <Page.Resources>
            <x:String x:Key="ChevronGlyph">&#xE26B;</x:String>
    
            <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
            <x:String x:Key="AppName">My Application</x:String>
        </Page.Resources>
        <!--
            This grid acts as a root panel for the page.
        -->
        <Grid >
            <ScrollViewer VerticalScrollMode="Enabled" HorizontalScrollMode="Disabled">
                <Hub >
                    <HubSection Background="{StaticResource BlueBackgroundApp}" Width="500"></HubSection>
                </Hub>
            </ScrollViewer>
        </Grid>
    </Page>

    I've tried to set the background in ScrollViewer but is still static.
    The GrayBackgroundApp and BlueBackgroundApp are ImageBrush's.


    Rui Peres - C# Fã


    • Edited by ruiperes Sunday, December 8, 2013 9:13 PM
    Sunday, December 8, 2013 8:46 PM
  • Hi Rui,

    That's not enough information to reproduce the problem. There is no scrolling involved in your sample code snippet.

    Can you please give more details about the problem code and exact repro steps with a comparison between the expected and the actual behavior. If you can share a minimal project which reproduces the problem on your SkyDrive that would be a great reference for your repro steps.

    --Rob

    Thursday, December 12, 2013 2:42 AM
    Moderator