visual tutorial studio que insertar imagen espaƱol ejemplos wpf background repeat brush

tutorial - Repita un pincel de fondo en WPF



wpf visual studio (3)

Gracioso, solo estaba haciendo lo mismo. Aqui tienes. Probablemente tengas que jugar con TileMode para establecer la dirección del mosaico, y ViewPort; los dos últimos números deberían ser el ancho / alto de tu imagen (tuve que hacer esto porque mi imagen se estiraba o simplemente no venía) a la derecha).

<ImageBrush x:Key="WindowBackground" ImageSource="/Images/Background.png" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,4,4" />

y gracias.

Esta pregunta es muy similar a esta vieja pregunta sin respuesta: ¿Cómo pintar líneas tipo cuaderno como fondo de TextBox? Sin embargo, no es lo mismo, no exactamente.

Me gustaría crear un bloc de notas con fondo de papel rayado, pero no estoy familiarizado con cómo repetir un pincel en XAML. ¿Cómo?

EDITAR

Esta es la solución como parte de un 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>


Usa un ImageBrush

<ImageBrush ImageSource="image.png" TileMode="Tile"/>


<DrawingBrush TileMode="Tile" Stretch="None" Viewport="0,0,20,20" ViewportUnits="Absolute"> <DrawingBrush.Drawing> <GeometryDrawing> <GeometryDrawing.Pen> <Pen Brush="Gray"/> </GeometryDrawing.Pen> <GeometryDrawing.Geometry> <LineGeometry StartPoint="0,0" EndPoint="20,0"/> </GeometryDrawing.Geometry> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush>