简体   繁体   中英

Scrollviewer inside a Viewbox?

So i'm having a little trouble with my scrollviewer, it was working fine but since I added viewbox it moved my scrollviewer to the edge of the viewbox so i cant scroll it anymore, any thoughts on how do I solve it? additional information: I want the row="0" to be "fixed" so it wont scroll with the row="1" The row="1" it always will be scrollable, I added the viewbox primally to make it responsive

sorry if I wasnt clear about my question first time asking here thanks!

 <Viewbox Stretch="UniformToFill">
            <Grid Background="#7c8486">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition MaxHeight="135"/>
                    <RowDefinition MinHeight="522"/>
                </Grid.RowDefinitions>
                <TextBlock
                Grid.Column="0"
                Grid.Row="0"
                x:Name="titulo"
                Text="Bem Vindo!"
                Margin="240,30,0,28"
                FontSize="48"
                Foreground="White"
             />
                <ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Hidden">
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="240"/>
                            <ColumnDefinition Width="350"/>
                            <ColumnDefinition Width="670"/>
                            <ColumnDefinition Width="670"/>
                            <ColumnDefinition Width="670"/>
                            <ColumnDefinition Width="350"/>
                            <ColumnDefinition Width="350"/>
                            <ColumnDefinition Width="240"/>
                        </Grid.ColumnDefinitions>

    MY ELEMENTS

                   </Grid>
                </ScrollViewer>
            </Grid>
        </Viewbox>
    </Page>

you can adjust the Width and Height .

<ScrollViewer Grid.Column ="0"  Width="768" Height="380" HorizontalScrollBarVisibility="Hidden">
    <Viewbox Stretch="None">
        <View:Map/>
    </Viewbox>
</ScrollViewer>

Whenever putting things in a Viewbox - you should specify their sizes explicitly, so you should set the Width and Height of your Grid or at least the ScrollViewer . Also - puttin a ScrollViewer in a Viewbox should be your last resort as it might scale the scroll bars/indicators to unreasonable/unusable dimensions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM