Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6336021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:58:09+00:00 2026-05-24T18:58:09+00:00

The root element of the window is a Grid which extends outside the boundary

  • 0

The root element of the window is a Grid which extends outside the boundary of the Window both horizontally and vertically.

I would like to be able to animate it such that I can display different parts of the grid in the Window.

See here for a great illustration of what I want to accomplish: http://www.japf.fr/2008/07/8/comment-page-1/

The difference in my approach from the link above is that I want to be able to pan vertically and horizontally and I do not care if everything is pre-rendered and kept in memory as there won’t be many pages.

So far I have a grid with two rows equal to the window height:

<Grid x:Name="Container" Background="#D4E8F2" VerticalAlignment="Top"
        d:DataContext="{Binding Source={StaticResource ItemDataSource}}" RenderTransformOrigin="0.5,0.5" >
    <Grid.RowDefinitions>
      <RowDefinition Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=ActualHeight}" />
      <RowDefinition Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=ActualHeight}" />
    </Grid.RowDefinitions>

    <Grid.RenderTransform>
      <TranslateTransform X="0" Y="0" />
    </Grid.RenderTransform>

      ...

</Grid>

And a button to run the animation by translating the grid in the Y-coord by the height of the window:

<Button Click="Button_Click" Content="Slide">
    <Button.Triggers>
      <EventTrigger RoutedEvent="Button.Click">
        <BeginStoryboard>
          <Storyboard>
            <DoubleAnimation Duration="0:0:1" To="200"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"
                Storyboard.TargetName="Container" d:IsOptimized="True" />
            <DoubleAnimation Duration="0:0:1"
                To="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=ActualHeight, Converter={StaticResource negateConvert}}"
                Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
                Storyboard.TargetName="Container" d:IsOptimized="True">
              <DoubleAnimation.EasingFunction>
                <QuadraticEase EasingMode="EaseInOut" />
              </DoubleAnimation.EasingFunction>
            </DoubleAnimation>
          </Storyboard>
        </BeginStoryboard>
      </EventTrigger>
    </Button.Triggers>
  </Button>

The problem is that the second row is not showing during and after the animation.

So it appears that the Grid is sized to the size of the window on startup and doesn’t change after that.

How can I pan across the grid to achieve the desired effect?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:58:11+00:00Added an answer on May 24, 2026 at 6:58 pm

    Put the Grid within a Canvas. The Grid is culling the contents that are offscreen.
    Here’s an example –

    If you take away the canvas the part of the rectangle that is offscreen will be culled.

    <Window x:Class="testOffscreenRenderTransform.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <Canvas>
            <Grid Margin="0,200,0,0">
            <Rectangle x:Name="testRect" Fill="Red" Width="200" Height="200" Margin="0,0,0,0">
                <Rectangle.Style>
                    <Style TargetType="{x:Type Rectangle}">
                        <Style.Triggers>
                            <EventTrigger RoutedEvent="Loaded">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="RenderTransform.(TranslateTransform.Y)"  To="-200" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Style.Triggers>
                    </Style>
                </Rectangle.Style>
                <Rectangle.RenderTransform>
                    <TranslateTransform X="0" Y="0" />
                </Rectangle.RenderTransform>
            </Rectangle>
            </Grid>
            </Canvas>
        </Grid>
    </Window>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid, a window root element. I want to apply an animation
I have a document that looks something like <root> <element> <subelement1 /> <subelement2 />
I would like to remove the resizing border from my WPF custom window. I
I would like to get the absolute position of an element in relation to
I have a DockPanel as the root element for my window. I have another
I need to create an XmlDocument with a root element containing multiple namespaces. Am
I'm interested in assigning the tag name of the root element in an xml
I am currently working within a WPF user control (the root element of my
I need to add an xmlns to the root element in the output of
I'm using XOM with the following sample data: Element root = cleanDoc.getRootElement(); //find all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.