我有以下XAML
<TabPanel>
<TreeView HorizontalAlignment="Left" Margin="0,0,0,0" Name="treeView1" MinWidth="212" SelectedItemChanged="treeView1_SelectedItemChanged" MinHeight="467" />
<ScrollViewer Margin="0,0,0,0" Name="scrollViewer1" HorizontalAlignment="Stretch" >
<ContentControl Name="gridView" />
</ScrollViewer>
</TabPanel>
Scrollviewer不会延伸到Tab面板的剩余部分。有谁知道如何实现这个目标?
尼尔。
答案 0 :(得分:2)
您的ContentControl控制ScrollViewer的宽度。试试这个:
<TabPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Name="col1" Width="*"/>
</Grid.ColumnDefinitions>
<TreeView HorizontalAlignment="Left"
Name="treeView1" Grid.Column="0"
MinHeight="467" MinWidth="212" />
<ScrollViewer Grid.Column="1" Name="scrollViewer1">
<ContentControl Name="gridView" Width="{Binding ElementName=col1, Path=ActualWidth}"/>
</ScrollViewer>
</Grid>
</TabPanel>