Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Sizing a FlowDocumentPageViewer in XAML

Closed Thread
 
Thread Tools Display Modes
Old 07-12-2007   #1 (permalink)
Mapsread
Guest


 

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!!

Old 07-12-2007   #2 (permalink)
Radek Cerny
Guest


 

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!!
>



Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to include XAML files into another XAML file? star-italia .NET General 6 06-12-2008 04:56 AM
picture down sizing ken Vista music pictures video 2 01-25-2008 12:05 AM
Sizing all columns. Dave Vista General 0 07-10-2007 01:20 PM
launching different XAML aplication from another XAML app SenthilVel Avalon 0 03-31-2007 09:40 PM
How to deploy an XAML-based App with its XAML-UI-File? Solveigh Avalon 11 11-08-2006 07:50 AM








Vistax64.com 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 2005-2008

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 47 48 49 50