2012-01-25 57 views
0

我目前正在編寫一個Silverlight應用程序來查看文檔。主面板是一個WrapPanel,在頁面左側和底部都有控件。目前,WrapPanel的寬度已設置爲任何需要能夠在一行上顯示所有文檔頁面的內容,並且我想對其進行更改,以便填充瀏覽器窗口的其餘部分,而不需要水平滾動條使用Silverlight應用程序中的所有瀏覽器空間

這是我當前的xaml,其中<doc:DocumentViewer x:Name="Viewer"..是有問題的包裝面板。

<UserControl x:Class="SilverlightXPSViewer.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:doc="http://schemas.firstfloorsoftware.com/documenttoolkit" 
    mc:Ignorable="d"> 
    <Grid x:Name="LayoutRoot" Background="White" > 
     <Grid.RowDefinitions> 
      <RowDefinition Height="*"/> 
      <RowDefinition Height="40" /> 
     </Grid.RowDefinitions> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="150" /> 
      <ColumnDefinition Width="*" /> 
      <ColumnDefinition Width="*" /> 
      <ColumnDefinition Width="140" /> 
     </Grid.ColumnDefinitions>  
     <doc:ThumbnailListBox x:Name="Thumbnails" Grid.Row="0" Grid.Column="0"  DocumentDataSource="{Binding ElementName=DataSource}" PageIndex="{Binding PageIndex,  Mode=TwoWay, ElementName=PageNavigator}"/> 
     <doc:DocumentViewer x:Name="Viewer" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3"   DocumentDataSource="{Binding ElementName=DataSource}" Width="{Binding ElementName=MainWidth}"/> 
     <doc:DocumentDataSource x:Name="DataSource" Grid.Row="0" LoadError="DataSource_LoadError" /> 
     <StackPanel Grid.Column="3" Grid.Row="1" Orientation="Horizontal"> 
      <doc:PageNavigator x:Name="PageNavigator" Margin="0" 
          PageCount="{Binding PageCount, ElementName=Viewer}" 
          PageIndex="{Binding PageIndex, ElementName=Viewer, Mode=TwoWay}"/> 
      <doc:PageNavigator /> 
     </StackPanel> 

     <doc:ViewModePicker Grid.Row="1" Grid.Column="0" x:Name="Collection"/> 
     <Button Width="200" Name="btnZoomIn" Grid.Row="1" Grid.Column="1" Cursor="Hand" Click="btnZoomIn_Click">Zoom In</Button> 
     <Button Width="200" Name="btnZoomOut" Grid.Row="1" Grid.Column="2" Cursor="Hand" Click="btnZoomOut_Click">Zoom Out</Button> 
    </Grid> 
</UserControl> 

回答

相關問題