• 0

XAML Scrollviewer not scrolling: WP8


Question

Why in the heck is the ScrollViewer not doing anything?  I've been checking a number of options but no matter what, the text (filled via C#) does not scroll

 <Grid x:Name="LayoutRoot" Background="DarkRed">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="0,0,0,4" Grid.ColumnSpan="2">
            <Grid x:Name="TitlebarGrid">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="55"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="55"/>
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" Height="48" Width="48" Source="/Assets/TinyTrain.png" Margin="4,5,4,4" />
                <Image Grid.Column="2" Height="48" Width="48" Source="/Assets/TinyTrain.png" Margin="50,5,-50,4" >
                    <Image.RenderTransform>
                        <ScaleTransform ScaleX="-1"/>
                    </Image.RenderTransform>
                </Image>
                <TextBlock HorizontalAlignment="Center" Grid.Column="1" Text="Big Apple Transit" FontSize="38" FontWeight="Bold" Style="{StaticResource PhoneTextNormalStyle}" Margin="0,0,0,0"/>
            </Grid>
        </StackPanel>

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0" Background="White" >
            <ScrollViewer Grid.Column="1" Height="auto" VerticalScrollBarVisibility="Visible" AllowDrop="False">
                <TextBlock Name="LineDetails" Opacity="0.0" Foreground="DarkRed" FontSize="24" TextWrapping="Wrap" />
            </ScrollViewer>
            
            <ListBox Name="BATList" Opacity="1.0" Foreground="DarkRed" FontSize="33" Margin="5" SelectionChanged="BATList_SelectionChanged">
                <ListBox.Resources>
                    <SolidColorBrush x:Key="AppAccentBrush" Color="#c0c0c0"></SolidColorBrush>
                </ListBox.Resources>
            </ListBox>
        </Grid>
    </Grid>
Link to comment
https://www.neowin.net/forum/topic/1173323-xaml-scrollviewer-not-scrolling-wp8/
Share on other sites

4 answers to this question

Recommended Posts

  • 0

A quick look at your xaml shows a few things:

The listbox is overlaying the scrollviewer

The scrollviewer has grid.column="1" set on it however the grid it's hosted in doesn't define any row or column definitions.

A textbox with wrap doesn't really need a scrollviewer as it has one within it's controltemplate to do... scrolling.

  • 0
  On 27/08/2013 at 13:42, SledgeNZ said:

A quick look at your xaml shows a few things:

The listbox is overlaying the scrollviewer

The scrollviewer has grid.column="1" set on it however the grid it's hosted in doesn't define any row or column definitions.

A textbox with wrap doesn't really need a scrollviewer as it has one within it's controltemplate to do... scrolling.

 

The ListBox is over the ScrollViewer because when the user selects a row in the ListBox the ListBox's Opacity is set to 0.0 so that the TextBlock is visible in the same space.   I have tried the ScrollViewer without the Grid.Column value as well (and wow, duh about the lack of Grid definitions) 

I have also tried the TextBlock with and without the WRAP but still not working

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0" Background="White" >
                <TextBlock Name="LineDetails" Opacity="0.0" Foreground="DarkRed" FontSize="24" TextWrapping="Wrap" />           
            <ListBox Name="BATList" Opacity="1.0" Foreground="DarkRed" FontSize="33" Margin="5" SelectionChanged="BATList_SelectionChanged">
                <ListBox.Resources>
                    <SolidColorBrush x:Key="AppAccentBrush" Color="#c0c0c0"></SolidColorBrush>
                </ListBox.Resources>
            </ListBox>
        </Grid>
    </Grid>

Thanks for the feedback though.

  • 0
  On 27/08/2013 at 14:32, SledgeNZ said:

If you remove the listbox from the 2nd grid does the text wrap? Could be it's contents are forcing the width of it's host grid to be extended beyond the bounds of your page.

 

This didn't work:

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0" Background="White" >
            
                <TextBlock Name="LineDetails" Opacity="1.0" Foreground="DarkRed" FontSize="24" TextWrapping="Wrap" />           
            
        </Grid>

This did work:

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0" Background="White" >
            <ScrollViewer Grid.Column="1" Height="auto" VerticalScrollBarVisibility="Visible" AllowDrop="False">
                <TextBlock Name="LineDetails" Opacity="1.0" Foreground="DarkRed" FontSize="24" TextWrapping="Wrap" />
            </ScrollViewer>
        </Grid>

So I'll have to look into how to show the controls.   Thank you very much

This topic is now closed to further replies.
  • Posts

    • The big MMOs can't be played on Linux, sadly, and those are the ones that matter, if we're being real. Yes, I know it's because of the anti-cheat, but still. Regarding professional work, that's something that only professionals can answer, the ones actually doing the work, not you or me. It might seem that you can do the same on Linux, but maybe they know the little details here and there that the general public isn't aware of (like you and me). And don't get me wrong, I like Linux, I use Linux, but IMO, it isn't just there yet (for the general public). Maybe on handheld devices, which are focused experiences, but not for general desktop work.
    • Tell you what, let me download Windows Media Center 8.9.2 and give this another crack.
    • Imagine if nobody ever kicked upstream to the Linux kernel. Bet we wouldn’t be seeing anything near as good as what we have today. But let’s give Apple a pass I guess.
    • RapidRAW 1.3.0 by Razvan Serea RapidRAW is a beautiful, non-destructive, GPU‑accelerated RAW image editor designed for speed and simplicity. It uses a lightweight (~30 MB), efficient code base built with Rust, React and Tauri. Ideal for Lightroom workflows, it offers rich editing tools—exposure, contrast, highlights, shadows, whites/blacks, tone curves, HSL mixer, dehaze, vignetting, film grain, sharpening, clarity and noise reduction—processed in real-time on the GPU. Features include intuitive masking (brush, linear, radial, AI-powered subject and foreground detection), generative edit layers (via ComfyUI), 32‑bit precision, and full RAW format support through rawler. RapidRAW also provides library management (folder navigation, ratings, metadata, EXIF viewer), batch operations, export presets (JPEG/PNG/TIFF), sidecar editing (.rrdata), undo/redo history, customizable UI themes, smooth animations, resizable panels, and preset copy/paste. A modern high-performance Lightroom alternative with polished UX and creative tools, RapidRAW brings powerful photo editing to photographers seeking speed, responsive GPU feedback, and streamlined workflows. RapidRAW 1.3.0 changelog: Fuji RAF X-Trans Support: most Fuji cameras and RAF files are now supported! The demosaicing algorithm still has room for improvement - particularly in the corners - but it’s already quite usable. Fixed a bug that caused the image to reload from disk every time the thumbnail was updated, which led to performance issues on slower systems. Download: RapidRAW 1.3.0 | 19.8 MB (Open Source) View: RapidRAW Home Page | Screenshot | Other operating systems Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Typically when the buying isnt attempting to find the cheapest deal but prefers the safest purchase, I recommend just buying it from the Microsoft Store directly, its a $99 upgrade from Home to Pro, its not a huge deal. I have had to do this a few times when they bought a PC off amazon that claimed it was Pro and was not.
  • Recent Achievements

    • Dedicated
      John Volks earned a badge
      Dedicated
    • One Month Later
      KenKay earned a badge
      One Month Later
    • Week One Done
      KenKay earned a badge
      Week One Done
    • Dedicated
      Amadou earned a badge
      Dedicated
    • One Month Later
      TheRingmaster earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      641
    2. 2
      ATLien_0
      244
    3. 3
      Xenon
      182
    4. 4
      neufuse
      154
    5. 5
      +FloatingFatMan
      123
  • Tell a friend

    Love Neowin? Tell a friend!