Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Sizing a FlowDocumentPageViewer in XAML

 
 
Old 07-12-2007   #1 (permalink)
Mapsread


 
 

Sizing a FlowDocumentPageViewer in XAML

Greetings,

I have a Window defined roughly as a Grid with a couple of controls
and a Stackpanel. The Stackpanel occupies the bottom third of the
Grid. The second component within the Stackpanel is a
FlowDocumentPageViewer. I'd like the height of the
FlowDocumentPageViewer to automatically fill the bottom part of the
Stackpanel and therefore the bottom part of the main Window as well.
Unfortunately the behavior I see is the FlowDocumentPageViewer
extending well below the viewable part of the Window, hiding the
controls that allow the user to scroll from page to page. I can hard-
code the height easily enough (I use 200 in my code snippet below),
but that defeats the point of having a Stackpanel and doesn't allow
for resizing, etc.

Is there a way to have the FlowDocumentPageViewer automatically resize
to fit the remainder (i.e. bottom portion) of the stackpanel? My guess
is that there is some markup extension somewhere that fits the bill,
but finding it eludes me.

Following is the window definition, without the details:

<Window x:Class=...>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Canvas Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Grid.RowSpan="2">
<MyControl:ctrlMyControl x:Name="m_ctrlClassicalWave"
Canvas.ZIndex="100" Canvas.Top="90" Canvas.Left="100"/>
<Image Canvas.Top="50" Canvas.Left="50">
...
</Image>
<Ellipse Canvas.Top="50" Canvas.Right="100" Width="30"
Height="100">
...
</Ellipse>
</Canvas>
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
<RichTextBox Height="18" Width="100">
...
</RichTextBox>
<FlowDocumentPageViewer Height="200">
<FlowDocument>
<Paragraph>
A bunch of paragraphs and text here that goes on for
several pages....
</Paragraph>
</FlowDocument>
</FlowDocumentPageViewer>
</StackPanel>
</Grid>
</Window>

Thanks in advance!!


My System SpecsSystem Spec
Old 07-12-2007   #2 (permalink)
Radek Cerny


 
 

Re: Sizing a FlowDocumentPageViewer in XAML

You could use a DockPanel, or try HorizonalAlignment=Stretch &
VerticalAlignment=Stretch.

"Mapsread" <cw_chw@yahoo.com> wrote in message
news:1184294391.081563.178660@n2g2000hse.googlegroups.com...
> Greetings,
>
> I have a Window defined roughly as a Grid with a couple of controls
> and a Stackpanel. The Stackpanel occupies the bottom third of the
> Grid. The second component within the Stackpanel is a
> FlowDocumentPageViewer. I'd like the height of the
> FlowDocumentPageViewer to automatically fill the bottom part of the
> Stackpanel and therefore the bottom part of the main Window as well.
> Unfortunately the behavior I see is the FlowDocumentPageViewer
> extending well below the viewable part of the Window, hiding the
> controls that allow the user to scroll from page to page. I can hard-
> code the height easily enough (I use 200 in my code snippet below),
> but that defeats the point of having a Stackpanel and doesn't allow
> for resizing, etc.
>
> Is there a way to have the FlowDocumentPageViewer automatically resize
> to fit the remainder (i.e. bottom portion) of the stackpanel? My guess
> is that there is some markup extension somewhere that fits the bill,
> but finding it eludes me.
>
> Following is the window definition, without the details:
>
> <Window x:Class=...>
> <Grid>
> <Grid.RowDefinitions>
> <RowDefinition/>
> <RowDefinition/>
> <RowDefinition/>
> </Grid.RowDefinitions>
> <Grid.ColumnDefinitions>
> <ColumnDefinition/>
> <ColumnDefinition/>
> </Grid.ColumnDefinitions>
> <Canvas Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
> Grid.RowSpan="2">
> <MyControl:ctrlMyControl x:Name="m_ctrlClassicalWave"
> Canvas.ZIndex="100" Canvas.Top="90" Canvas.Left="100"/>
> <Image Canvas.Top="50" Canvas.Left="50">
> ...
> </Image>
> <Ellipse Canvas.Top="50" Canvas.Right="100" Width="30"
> Height="100">
> ...
> </Ellipse>
> </Canvas>
> <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
> <RichTextBox Height="18" Width="100">
> ...
> </RichTextBox>
> <FlowDocumentPageViewer Height="200">
> <FlowDocument>
> <Paragraph>
> A bunch of paragraphs and text here that goes on for
> several pages....
> </Paragraph>
> </FlowDocument>
> </FlowDocumentPageViewer>
> </StackPanel>
> </Grid>
> </Window>
>
> Thanks in advance!!
>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Is it possible to include XAML files into another XAML file? .NET General
Desktop Sizing Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46