i dziękuję.Powtórz pędzel tła w WPF
To pytanie jest bardzo podobne do tego starego, bez odpowiedzi pytania tutaj: How to paint notebook-like lines as TextBox background? To jednak nie to samo - nie do końca.
Chciałbym stworzyć notatnik, wyłożone papieropodobnym tłem, ale nie wiem, jak powtórzyć pędzla w XAML. Jak się masz?
EDIT
Oto rozwiązanie w ramach 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>
chodzi sugerowanej EDIT: zgadzam się, proszę wyodrębnić konkretne rozwiązanie do osobnego odpowiedź. (Ewentualnie dodaj notatkę o tym, jak "LineHeight" i "LineStackingStrategy" rozwiązują problem wyrównania, jeśli jest to wymagane). –