e grazie.Ripeti uno sfondo pennello in WPF
Questa domanda è molto simile a questa vecchia domanda senza risposta qui: How to paint notebook-like lines as TextBox background? Tuttavia, non è la stessa - non esattamente.
Mi piacerebbe creare un blocco note, foderato come sfondo di carta, ma non ho familiarità con come ripetere un pennello in XAML. Come?
EDIT
Ecco la soluzione come parte di una TextBox:
<TextBox TextBlock.LineHeight="20"
TextBlock.LineStackingStrategy="BlockLineHeight"
Padding="20,10,20,20" TextWrapping="Wrap">
<TextBox.Background>
<DrawingBrush TileMode="Tile" Stretch="None" Viewport="0,0,20,20"
ViewportUnits="Absolute" Opacity=".07">
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="RoyalBlue" />
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<LineGeometry StartPoint="0,0" EndPoint="20,0"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</TextBox.Background>
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
Now is the time for all good men to come to the aid of their country.
</TextBox>
Per quanto riguarda la modifica suggerita: Sono d'accordo, si prega di estrarre la vostra soluzione concreta in una risposta separata. (Eventualmente aggiungere anche una nota su come 'LineHeight' e' LineStackingStrategy' risolvono il problema di allineamento, se necessario) –