简体   繁体   中英

Can't see or scroll to items in ScrollViewer

Ok so I have a grid that holds the menubar then in that grid I have a scrollviewer that holds another grid. If I put lets say a label on the most inner grid (one with scrollviewer) out of view all down vertically the scrollviewer cannot scroll so I can see it for some reason.

I set max heights for the scrollviewer and grid... and also added a button that we cannot scroll to.

<Grid Background="#FF1C1C1C" Margin="0,0,0,-1" Width="1160" ScrollViewer.CanContentScroll="True" MinWidth="1160">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="55*"/>
    </Grid.ColumnDefinitions>
    <Menu HorizontalAlignment="Left" Height="19" VerticalAlignment="Top" Width="1150">
        <Menu.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0"/>
                <GradientStop Color="#FF343333" Offset="1"/>
            </LinearGradientBrush>
        </Menu.Background>
        <MenuItem Header="FILE" Foreground="White">
            <MenuItem Header="Open Accounts.txt" HorizontalAlignment="Left" Background="#FF1C1C1C"/>
            <MenuItem Header="Exit" HorizontalAlignment="Left" Width="187" Background="#FF1C1C1C"/>
        </MenuItem>
        <MenuItem Header="SERVER" Foreground="White">
            <MenuItem Header="Start" HorizontalAlignment="Left" Width="145" Background="#FF1C1C1C"/>
            <MenuItem Header="Close" HorizontalAlignment="Left" Width="145" Background="#FF1C1C1C"/>
        </MenuItem>
        <MenuItem Header="VIEW" Foreground="White" Background="#FF1C1C1C">
            <MenuItem Header="Client Manager" HorizontalAlignment="Left" Background="#FF1C1C1C"/>
            <MenuItem Header="Search Utility" HorizontalAlignment="Left" Width="171" Background="#FF1C1C1C"/>
            <MenuItem x:Name="DebugLogButton" Header="Debug Logger" HorizontalAlignment="Left" Width="171" Background="#FF1C1C1C" Click="onDebugLogClick"/>
        </MenuItem>
    </Menu>
    <ScrollViewer Opacity="0.1" VerticalContentAlignment="Stretch" Margin="0,0,10,0" MinWidth="1150" MaxWidth="1150" Width="1150" MinHeight="600" MaxHeight="1500">
        <Grid Width="1118" MinWidth="1118" MaxWidth="1118" MaxHeight="1500">
            <Button Content="Button" HorizontalAlignment="Left" Margin="542,2479,0,-1890" VerticalAlignment="Top" Width="75"/>

        </Grid>
    </ScrollViewer>
</Grid>

I have resolved it.

The issue is improper use of Grid I now know that I need to make a row definition for the scroll viewer.

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