I am trying to create one rectangle filled with Horizontal or Vertical lines. The width of the rectangle is dynamic so I can not use an image brush. Please let me know if anybody knows any solution.
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
I figured out a straight-forward way of doing this; finally, I used following visual brush resources to fill rectangle with horizontal, vertical or dotted vertical lines respectively
ImageBrush
derives fromTileBrush
so you can use theViewport
property to repeat the image. See this MSDN page for an example.Have you tried using a TileBrush?
You can easily do this with a LinearGradientBrush:
You control line thickness and orientation with the EndPoint property.