如何正确添加scrollviewer到此布局?
我尝试将垂直滚动查看器添加到我的主网格中,但它不起作用。
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="White" ScrollViewer.VerticalScrollBarVisibility="Auto">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28"/>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Margin="12,167,8,-588" Grid.RowSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="169*"/>
<ColumnDefinition Width="287*"/>
</Grid.ColumnDefinitions>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="25,21,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Search" Grid.ColumnSpan="2" ImageSource="/Assets/Apps-Magnifier-Metro-icon.png"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="76,21,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Grid.Column="1" Title="How It Works"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="25,196,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Physiotherapists" Grid.ColumnSpan="2"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="76,196,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Articles Of Week" Grid.Column="1"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="25,364,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Blog Of Week" Grid.ColumnSpan="2"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="76,364,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Pod Casts" Grid.Column="1"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="25,549,0,-111" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Jobs" Grid.ColumnSpan="2"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="76,549,0,-111" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Courses" Grid.Column="1"/>
</Grid>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="41,17,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="About Us"/>
<telerikPrimitives:RadHubTile HorizontalAlignment="Left" Margin="255,17,0,0" VerticalAlignment="Top" Height="153" Width="168" Background="#25A1DA" Title="Contact"/>
</Grid>
答案 0 :(得分:1)
您的scrollviewer
只能包含1个元素。知道你必须使grid
可滚动而不是它的内容
它看起来像这样:
<ScrollViewer>
<Grid x:Name="LayoutRoot" Background="White">
//Content here
</Grid>
</ScrollViewer>
需要滚动网格。不是里面的控件。