Nyi Nyi Thann

Hi All,

I would like to ask you some questions. Plsease refer to the following xaml file.
If u copy and paste the following xaml into XamlPad, you will notice that column lines are crossing through the image which spans 2 columns. I don't want to hide such column lines and i don't want to hide other column lines. And you will also notice that the first paragraph is a little lower that others.

I want to amend such things. How should i do

your help will be highly appreciated.


<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ColumnWidth="200"
ColumnGap="20" ColumnRuleBrush="Black" ColumnRuleWidth=".5"
IsColumnWidthFlexible="True" IsHyphenationEnabled="True" IsOptimalParagraphEnabled="True"
>
<FlowDocument.Resources>
<Style x:Key="Title" TargetType="Paragraph">
<Setter Property="FontFamily" Value="Georgia" />
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="KeepWithNext" Value="True" />
<Setter Property="IsHyphenationEnabled" Value="False" />
<Setter Property="Margin" Value="0"/>
</Style>
<Style x:Key="EmphasizedTitle" TargetType="Paragraph" BasedOn="{StaticResource Title}" >
<Setter Property="FontSize" Value="18"/>
<Setter Property="Margin" Value="0,0,0,5"/>
</Style>

<Style x:Key="FirstParagraph" TargetType="Paragraph">
<Setter Property="FontFamily" Value="Candara, Verdana" />
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="TextAlignment" Value="Left"/>
<Setter Property="KeepWithNext" Value="True" />
<Setter Property="Margin" Value="0,0,0,15"/>
<Setter Property="TextIndent" Value="0" />
</Style>

<Style x:Key="WriterName" TargetType="Paragraph" BasedOn="{StaticResource FirstParagraph}">
<Setter Property="Foreground" Value="Gray"/>
<Setter Property="Margin" Value="0,0,0,3"/>
</Style>
</FlowDocument.Resources>



<Section Margin="0">
<Paragraph Margin="0" >
<Figure Name="fig" Margin="0,3,3,0" Padding="0" Width="2 Column" HorizontalAnchor="ContentCenter" CanDelayPlacement="True" VerticalAnchor="ContentTop">
<BlockUIContainer>
<Image >
<Image.Source>
<BitmapImage UriSource="http://nyinyithann.googlepages.com/Test1.jpg/Test1-full.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
<Paragraph>LONDON - HOLDERS AC Milan took the first step on the long road to Moscow when they opened their Champions League campaign with a 2-1 victory over Benfica on Tuesday.
</Paragraph>
<BlockUIContainer>
<Line X1="0" Y1="0" X2="450" Y2="0" Margin="0,7,0,10" Stroke ="Black" StrokeThickness=".5" HorizontalAlignment="Center" />
</BlockUIContainer>

</Figure>
</Paragraph>
</Section>

<Section>

<Paragraph Style="{StaticResource EmphasizedTitle}">
China steps up scrutiny of US food, delaying shipments
</Paragraph>

<Paragraph Style="{StaticResource WriterName}">
By JORGE O' WELL
</Paragraph>

<Paragraph Style="{StaticResource FirstParagraph}" TextIndent="0">
<Figure Margin="0,3,3,0" Padding="0" Height="50" Width="50" HorizontalAnchor="ColumnLeft" VerticalAnchor="ParagraphTop">
<BlockUIContainer>
<Image >
<Image.Source>
<BitmapImage DecodePixelHeight="50" DecodePixelWidth="50" UriSource="http://nyinyithann.googlepages.com/Test.jpg/Test-full.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure>BEIJING - CHINA has sharply increased inspections of imported US food, escalating its spat with Washington over product safety and leaving American beef piling up in warehouses and delaying shipments of black pepper and other goods.

</Paragraph>
</Section>

<Section>
<Paragraph Style="{StaticResource EmphasizedTitle}">
China steps up scrutiny of US food, delaying shipments
</Paragraph>

<Paragraph Style="{StaticResource WriterName}">
By JORGE O' WELL
</Paragraph>

<Paragraph Style="{StaticResource FirstParagraph}" TextIndent="0">
<Figure Margin="0,3,3,0" Padding="0" Height="50" Width="50" HorizontalAnchor="ColumnLeft" VerticalAnchor="ParagraphTop">
<BlockUIContainer>
<Image >
<Image.Source>
<BitmapImage DecodePixelHeight="50" DecodePixelWidth="50" UriSource="http://nyinyithann.googlepages.com/Test.jpg/Test-full.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure> BEIJING - CHINA has sharply increased inspections of imported US food, escalating its spat with Washington over product safety and leaving American beef piling up in warehouses and delaying shipments of black pepper and other goods.

</Paragraph>
</Section>

<Section>
<Paragraph Style="{StaticResource EmphasizedTitle}">
China steps up scrutiny of US food, delaying shipments
</Paragraph>

<Paragraph Style="{StaticResource WriterName}">
By JORGE O' WELL
</Paragraph>

<Paragraph Style="{StaticResource FirstParagraph}" TextIndent="0">
<Figure Margin="0,3,3,0" Padding="0" Height="50" Width="50" HorizontalAnchor="ColumnLeft" VerticalAnchor="ParagraphTop">
<BlockUIContainer>
<Image >
<Image.Source>
<BitmapImage DecodePixelHeight="50" DecodePixelWidth="50" UriSource="http://nyinyithann.googlepages.com/Test.jpg/Test-full.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure> BEIJING - CHINA has sharply increased inspections of imported US food, escalating its spat with Washington over product safety and leaving American beef piling up in warehouses and delaying shipments of black pepper and other goods.

</Paragraph>
</Section>

<Section>
<Paragraph Style="{StaticResource EmphasizedTitle}">
China steps up scrutiny of US food, delaying shipments
</Paragraph>

<Paragraph Style="{StaticResource WriterName}">
By JORGE O' WELL
</Paragraph>

<Paragraph Style="{StaticResource FirstParagraph}" TextIndent="0">
<Figure Margin="0,3,3,0" Padding="0" Height="50" Width="50" HorizontalAnchor="ColumnLeft" VerticalAnchor="ParagraphTop">
<BlockUIContainer>
<Image >
<Image.Source>
<BitmapImage DecodePixelHeight="50" DecodePixelWidth="50" UriSource="http://nyinyithann.googlepages.com/Test.jpg/Test-full.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure> BEIJING - CHINA has sharply increased inspections of imported US food, escalating its spat with Washington over product safety and leaving American beef piling up in warehouses and delaying shipments of black pepper and other goods.

</Paragraph>
</Section>
<Section>
<Paragraph Style="{StaticResource EmphasizedTitle}">
China steps up scrutiny of US food, delaying shipments
</Paragraph>

<Paragraph Style="{StaticResource WriterName}">
By JORGE O' WELL
</Paragraph>

<Paragraph Style="{StaticResource FirstParagraph}" TextIndent="0">
<Figure Margin="0,3,3,0" Padding="0" Height="50" Width="50" HorizontalAnchor="ColumnLeft" VerticalAnchor="ParagraphTop">
<BlockUIContainer>
<Image >
<Image.Source>
<BitmapImage DecodePixelHeight="50" DecodePixelWidth="50" UriSource="http://nyinyithann.googlepages.com/Test.jpg/Test-full.jpg"/>
</Image.Source>
</Image>
</BlockUIContainer>
</Figure> BEIJING - CHINA has sharply increased inspections of imported US food, escalating its spat with Washington over product safety and leaving American beef piling up in warehouses and delaying shipments of black pepper and other goods.

</Paragraph>
</Section>




</FlowDocument>




Re: Windows Presentation Foundation (WPF) FlowDocument Layout

Dr. WPF

To solve the problem you're having with column lines, you can set the Background property on the Figure that contains the large image and it's subtitle. The following works:

Code Snippet

<Figure Background="White" Name="fig" . . .

As for positioning the initial paragraph, you're going to have to find someone who knows the Documents namespace better. It's probably a Typography or Block property that needs to be set. You might want to post a separate question with a simpler example and a title that will catch the eye of the right person. Something like "Initial Paragraph Placement in FlowDocument".






Re: Windows Presentation Foundation (WPF) FlowDocument Layout

Nyi Nyi Thann

Hi Dr. WPF,

Thanks a lot. It works.

Regards,
Nyi Nyi