Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 10 Universal app flyout, how to remove scrollbars?

I've got a Flyout view with a TextBlock in it. The text block has more than one line's amount of text and I'd like it to wrap to the next line like it usually does, but when used in a Flyout it scrolls off the screen... How do you disable the scroll view in a Flyout?

Flyout XAML:

...
  <AppBarButton.Flyout>
    <Flyout Placement="Full">
      <local:MyView/>
    </Flyout>
  </AppBarButton.Flyout>
...

My View XAML:

<UserControl ...>
  <Grid>
    ...
    <TextBlock Text="Loading..." Style="{ThemeResource SubtitleTextBlockStyle}" Margin="10,0,10,20" Grid.Row="1" TextWrapping="Wrap"/>
  </Grid>
</UserControl>

It comes out like this:

Wrapping problem

like image 200
jjv360 Avatar asked Aug 31 '15 13:08

jjv360


People also ask

How do I get rid of the scroll bar in Windows 10?

Click on Start > Ease of Access. Scroll down on the left and Check or uncheck Automatically hide scroll bars in Windows.

How do I change the scrollbar on Windows 10?

Double-click/tap on ScrollHeight. The Edit String window will open with the default value of -255. That is the standard size of the scrollbars you see on Windows. To change the Scrollbars height to your liking, enter a value between -120 (smaller) to -1500 (larger) for the size you want, and click/tap on OK.

How do I unhide the scroll bar in Windows 10?

Click Start > Settings. Under Windows Settings, scroll down, and then click Ease of Access > Display. Scroll down, and then set Automatically hide scroll bars in Windows to Off.


2 Answers

To set properties of Flyout like width or scrollbar's visibility, we need to customize the style of FlyoutPresenter. Here is how I do it:

            <Flyout Placement="Full" >
                <Flyout.FlyoutPresenterStyle>
                    <Style TargetType="FlyoutPresenter">
                        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
                    </Style>
                </Flyout.FlyoutPresenterStyle>
                <Grid>
                <TextBlock Text="This is an informational flyout. Click outside to dismiss.xxxjfdalisfsadpfuaspdfoia" Grid.Row="1" TextWrapping="Wrap"/>
                </Grid>
            </Flyout>

Directly copy the into your Flyout element will meet your requirement.

like image 169
Alan Yao - MSFT Avatar answered Nov 08 '22 19:11

Alan Yao - MSFT


You can 1) make a maxwidth to your flyout

or

2) try this :

<Flyout Placement="full" >                 
<Grid   ScrollViewer.VerticalScrollBarVisibility="Disabled"  ScrollViewer.HorizontalScrollBarVisibility="Disabled">
........
  </Grid>
 </Flyout>

best of luck !

like image 44
Amine Da. Avatar answered Nov 08 '22 19:11

Amine Da.