• 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

    • Meta pulls political ads in the EU due to new regulations by Paul Hill Meta has announced that it will no longer allow political, electoral, or social issue ads on its platforms in the European Union starting in early October 2025. This is in direct response to the EU’s upcoming Transparency and Targeting of Political Advertising (TTPA) regulation. According to the social media giant, the TTPA introduces “unworkable requirements and legal uncertainties” that make it too hard to continue offering those ad services. The ban on these types of ads will be limited to the EU and it will continue to allow political ads on its service in other parts of the world. The company will also allow people and politicians in the EU to post and debate politics organically on its platforms, they just can’t pay to amplify it. Meta said that the TTPA places extensive restrictions on ad targeting and delivery, and will make ads less relevant to users. It also believes that the measures undermine personalized advertising which it believes is crucial for advertisers and users. The company has already introduced transparency tools for political ads back in 2018, such as requiring authorization and public disclosure in its Ad Library. Commenting on its action, Meta said: With this ban in place, it will restrict how political and social issue advertisers can reach audiences through paid promotions on Meta’s platform. It could also impact the ability of voters to get comprehensive information about the various campaigns. On this point, Meta thinks personalized ads are critical for informing voters about important social issues. It’ll be interesting to see what impact this has on political campaigns in the EU. Those politicians without deep pockets may like this move as it creates a more level playing field and prevents those with deep pockets from drowning out other candidates’ voices. On the flip side, it could see candidates use less transparent methods to get their views across to the public. Source: Meta | Image via Depositphotos.com
    • They need to refactor their internal code to remove .NET Framework and third party libraries. Use .NET 10 or Rust. Stop bundling AI crap, it does not work.
    • Liberals have been , since the ‘60s, declaring that all you need is peace and love. At least until Trump ran for office. After that they have been letting out 50 years of repressed hatred. That’s all they really are anymore, angry and hateful. 
    • Zen Browser 1.14.6b by Razvan Serea Zen Browser is a privacy-focused, open-source web browser built on Mozilla Firefox, offering users a secure and customizable browsing experience. It emphasizes privacy by blocking trackers, ads, and ensuring your data isn't collected. With Zen Mods, users can enhance their browser experience with various customization options, including features like split views and vertical tabs. The browser is designed for efficiency, providing fast browsing speeds and a lightweight interface. Zen Browser prioritizes user control over the browsing experience, offering a minimal yet powerful alternative to traditional web browsers while keeping your online activity private. Zen Browser’s DRM limitation Zen Browser currently lacks support for DRM-protected content, meaning streaming services like Netflix and HBO Max are inaccessible. This is due to the absence of a Widevine license, which requires significant costs and is financially unfeasible for the developer. Additionally, applying for this license would require Zen to be part of a larger company, similar to Mozilla or Brave. Therefore, DRM-protected media won't be supported in Zen Browser for the foreseeable future. Zen Browser offers features that improve user experience, privacy, and customization: Privacy-Focused: Blocks trackers and minimizes data collection. Automatic Updates: Keeps the browser updated with security patches. Zen Mods: Customizable themes and layouts. Workspaces: Organize tabs into different workspaces. Compact Mode: Maximizes screen space by minimizing UI elements. Zen Glance: Quick website previews. Split Views: View multiple tabs in the same window. Sidebar: Access bookmarks and tools quickly. Vertical Tabs: Manage tabs vertically. Container Tabs: Separate browsing sessions. Fast Profile Switcher: Switch between profiles easily. Tab Folders: Organize tabs into folders. Customizable UI: Personalize browser interface. Security Features: Inherits Firefox’s robust security. Fast Performance: Lightweight and optimized for speed. Zen Mods Customization: Deep customization with mods. Quick Access: Easy access to favorite websites. Open Source: Built on Mozilla Firefox with community collaboration. Community-Driven: Active development and feedback from users. GitHub Repository: Contribute and review the source code. Zen Browser 1.14.6b changelog: Security Various security fixes New Features Updated to Firefox 141.0 Improved accent color detection, making elements such as toasts more vibrant. Added a better custom color picker (experimental UI, might change) Improved and optimized glance animations and UI WebGPU is now enabled by default on windows Added a more native feel to windows 11 window buttons Fixes picture caching and scroll optimization issues a bug where adding or removing colors in the color picker would make the UI white On Linux, Zen uses less memory and no longer requires a forced restart after an update has been applied by a package manager. Fixed 'copy calculation' in the urlbar not working Download: Zen Browser | 82.3 MB (Open Source) Download: Zen Browser ARM64 | Other Operating Systems View: Zen Browser Home Page | Screenshots 1 | 2 | Reddit Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • You reap as you sow - he enabled hate, so he can receive a level of it.
  • Recent Achievements

    • Dedicated
      Snake Doc earned a badge
      Dedicated
    • One Month Later
      Philsl earned a badge
      One Month Later
    • One Year In
      armandointerior640 earned a badge
      One Year In
    • One Month Later
      armandointerior640 earned a badge
      One Month Later
    • Week One Done
      Itbob513626 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      613
    2. 2
      ATLien_0
      236
    3. 3
      Xenon
      156
    4. 4
      +FloatingFatMan
      123
    5. 5
      Michael Scrip
      113
  • Tell a friend

    Love Neowin? Tell a friend!