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

  • SEARCH
  • Home
  • 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 7721149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:51:04+00:00 2026-06-01T03:51:04+00:00

We’re writing an application for Windows tablet PCs. I have created a custom control

  • 0

We’re writing an application for Windows tablet PCs. I have created a custom control that uses a SurfaceScrollViewer to render a vertical and scrollable list to the right of the window. The control uses an Adorner to add itself to the adorner layer of the Window so that it can be rendered over the top of the window content.

It works really nicely, but the surface scroll viewer will only scroll through the mouse wheel or through the scroll bar. I’d like to be able to hide the scroll bar and rely on the user dragging the list by touch, but this refuses to work. We’ve used the SurfaceScrollViewer control elsewhere in this project and this has worked fine, so I’m guessing that this issue is down to either how the control has been built, or maybe because it’s in an AdornerLayer? Something to do with registering touch with Surface? The strange thing is that the SurfaceButton controls in the list work fine.

Any help or advice would be most appreciated. This is basically the custom control. I’ve removed a couple of binding bits and pieces to cut down the size, and I’ve added the surrounding Window/AdornerLayer/Adorner elements to put it in context.

EDIT – The adorner is actually added to the adorner layer of a Grid which is a child of the Window. I’ve updated the XAML below.

<Window x:Name="Main">
    <Grid>
        <AdornerDecorator>

            <!-- Adorner layer added to Window in code-behind -->
            <AdornerLayer>
                <Adorner>

                    <!-- Custom Control Starts Here -->
                    <Grid x:Name="root" Visibility="Collapsed" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Window}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Window}}">

                        <Controls:SurfaceButton x:Name="btnCloser" Opacity="0" Background="White"/>

                        <Grid x:Name="menu" Width="400" HorizontalAlignment="Right" VerticalAlignment="Stretch">

                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="20"/>
                                <RowDefinition />
                                <RowDefinition Height="20"/>
                            </Grid.RowDefinitions>

                            <Border Opacity="0.75" BorderThickness="0" Background="Black" Grid.RowSpan="5" />

                            <TextBlock Text="{TemplateBinding Title}" FontSize="24" Grid.Row="1" Foreground="White" HorizontalAlignment="Center" Margin="10"/>

                            <Controls:SurfaceScrollViewer Grid.Row="3" Margin="5" Elasticity="0.0, 0.5" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                                <ItemsControl x:Name="items" Background="Transparent" ItemsSource="{TemplateBinding MenuItems}">
                                    <ItemsControl.Style>
                                        <Style>
                                            <Setter Property="ItemsControl.ItemsPanel">
                                                <Setter.Value>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel />
                                                    </ItemsPanelTemplate>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="ItemsControl.ItemTemplate">
                                                <Setter.Value>
                                                    <DataTemplate>
                                                        <Controls:MyButton HorizontalContentAlignment="Center" Margin="3" Content="(Bound Stuff)" Background="(Bound Stuff)"/>
                                                    </DataTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </ItemsControl.Style>
                                </ItemsControl>
                            </Controls:SurfaceScrollViewer>

                        </Grid>
                    </Grid>
                </Adorner>
            </AdornerLayer>
        </AdornerDecorator>
    </Grid>
</Window>
  • 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-06-01T03:51:06+00:00Added an answer on June 1, 2026 at 3:51 am

    Okay – I got to the bottom of it. I realised that the answer is the same one that has come up several times during this project, yet I still lose sight of it every now and then. Maybe this time it’ll sink in for good!

    The problem was the ItemsControl. It’s not a Surface control, and so it wasn’t playing nicely with the Surface controls. I think essentially what happens is that the Surface controls tend to gobble up events before anything else gets a chance – or maybe it’s the other way around.

    Anyway, I replaced it with the following SurfaceListBox and this has worked a treat!

    <Controls:SurfaceListBox x:Name="items" Margin="5" Grid.Row="3" Background="Transparent" ItemsSource="{TemplateBinding MenuItems}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Hidden">
        <Controls:SurfaceListBox.Resources>
            <Converters:PropertyNameReflectionConverter x:Key="ButtonContentConverter"/>
            <Converters:SelectedItemBackgroundConverter x:Key="ButtonBackgroundConverter"/>
        </Controls:SurfaceListBox.Resources>
        <Controls:SurfaceListBox.ItemContainerStyle>
            <Style TargetType="Controls:SurfaceListBoxItem">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Controls:SurfaceListBoxItem}">
                            <ContentPresenter />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Controls:SurfaceListBox.ItemContainerStyle>
        <Controls:SurfaceListBox.ItemTemplate>
            <DataTemplate DataType="Controls:MyButton">
                <Controls:MyButton HorizontalContentAlignment="Center" Margin="3" Background="(Bound Stuff)" Content="(Bound Stuff)"/>
            </DataTemplate>
        </Controls:SurfaceListBox.ItemTemplate>
    </Controls:SurfaceListBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.