无法查看或滚动到ScrollViewer中的项目

时间:2014-12-15 01:09:19

标签: c# user-interface uiscrollview

好的,所以我有一个网格,然后在该网格中保存菜单栏我有一个滚动查看器,可以容纳另一个网格。如果我把最内部网格上的标签(一个带有scrollviewer)放在视图之外全部向下垂直滚动查看器无法滚动,所以我可以看到它出于某种原因。

我为scrollviewer和grid设置了最大高度...还添加了一个我们无法滚动到的按钮。

<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>

1 个答案:

答案 0 :(得分:0)

我已经解决了。

问题是Grid的使用不当我现在知道我需要为滚动查看器做一个行定义。