我有一个带有网格的silverlight3.0 应用程序。XAML 如下。当用户更改左列的宽度时,我希望调整 TreeView 控件的大小和包装内容。目前,树视图显示滚动条而不是换行。在右栏中,这工作正常,因为没有树视图但堆栈面板。
当我使用 HierarchicalDataTemplate 而不是静态树视图项时,也会发生同样的情况。
关于如何使这项工作的任何想法?
谢谢,-cc
<Grid x:Name="LayoutRoot" Background="Aqua">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" Background="Yellow">
<controls:TreeView >
<controls:TreeViewItem Header="test1 some text some text some text some text some text">
<controls:TreeViewItem Header="test1.1 some text some text some text some text some text">
</controls:TreeViewItem>
</controls:TreeViewItem>
<controls:TreeViewItem Header="test2 some text some text some text some text some text some text some text some text some text some text some text">
<controls:TreeViewItem Header="test2 some text some text some text some text some text some text some text some text some text some text some text">
</controls:TreeViewItem>
</controls:TreeViewItem>
</controls:TreeView>
</StackPanel>
<controls:GridSplitter Grid.Row="0" Grid.Column="1" Width="5" VerticalAlignment="Stretch"
HorizontalAlignment="Center" Background="AliceBlue"/>
<StackPanel Grid.Column="2" Orientation="Vertical">
<TextBlock TextWrapping="Wrap"> dwd kwdh wkd wkd wkd wkjd hwkdjhw kdw dkw k</TextBlock>
<TextBlock TextWrapping="Wrap"> dwd kwdh wkd wkd wkd wkjd hwkdjdwd kwdh wkd wkd wkd wkjd hwkdjhw kdw dkw k</TextBlock>
</StackPanel>
</Grid>