我剛剛開始使用2.0版的Silverlight。我想在頁面上顯示一些數據網格,並通過將每個數據網格放入網格單元格中來實現這一點。那麼我想我會嘗試使用下面的標記添加網格分流:Silverlight Grid Splitter意外的行爲
<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" x:Class="SilverlightApplication1.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="UserControl_Loaded">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<basics:GridSplitter Grid.RowSpan="2" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Width="5" VerticalAlignment="Stretch" ></basics:GridSplitter>
<data:DataGrid Name="TLGrid" Grid.Row="0" Grid.Column="0">
</data:DataGrid>
<data:DataGrid Name="TRGrid" Grid.Row="0" Grid.Column="2">
</data:DataGrid>
<data:DataGrid Name="BLGrid" Grid.Row="1" Grid.Column="0">
</data:DataGrid>
<data:DataGrid Name="BRGrid" Grid.Row="1" Grid.Column="2">
</data:DataGrid>
</Grid>
</UserControl>
我希望能夠拖動分離器來調整其他兩列。當我拖動欄時,其他欄都縮小。誰能解釋爲什麼?
謝謝,那完美的作品。 – 2009-02-17 14:16:55