tags:

views:

41

answers:

1

<DockPanel LastChildFill="True" Height="18">
<Image Height="18" Width="80">
    <Image.Source>
        <DrawingImage>
            <DrawingImage.Drawing>
                <GeometryDrawing Brush="Black">
                    <GeometryDrawing.Geometry>
                        <LineGeometry StartPoint="0,9" EndPoint="38,9" />
                    </GeometryDrawing.Geometry>
                    <GeometryDrawing.Pen>
                        <Pen DashCap="Flat"
                             Brush="Black"
                             Thickness="0.5"
                             DashStyle="{x:Static DashStyles.Dot}, Mode=OneTime}"
                         />
                    </GeometryDrawing.Pen>
                </GeometryDrawing>
            </DrawingImage.Drawing>
        </DrawingImage>
    </Image.Source>
</Image>
<TextBlock Height="18" Text="{Binding Name, Mode=OneTime}" Margin="3,2,5,0" />
</DockPanel>
A: 

Remove DashCap="Flat" and you will see the dots. There are other DashCaps that will work: Round, Square, Triangle.

Drew Marsh
Great, you are my hero. I was trying to fixed it have nearly 2 hours.
Cooper.Wu
I have other question: How to draw a line directly with set different Dashstyles, like Dot, Dash, DashDot... ?
Cooper.Wu
I'm not sure I understand the new question. Do you mean how can you control the dash pattern? You should start another question and give some more details on what you want to do and I'll see if I can help.
Drew Marsh
My question is: How to directly draw a line with dash style?
Cooper.Wu
I guess I don't understand what you mean by "directly". Do you mean you want to *programatically* draw a line?
Drew Marsh