Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF repeated image background

Tags:

background

wpf

i using C# and WPF building my project. In my application, i used a small size of image(25x25) as my application background. I found some example from the internet and when i try it, the background of my application is like imageA. But what i wish to do is like my background will be like the imageB. Any one know how to make it like the imageB?

my WPF code snippet:

<Grid>
    <Grid.Background>
        <VisualBrush TileMode="Tile" Viewport="0.8,0.8,0.1,0.1"  AlignmentX="Left" AlignmentY="Top">
            <VisualBrush.Visual>
                <Image Source="/Wpf_Customer;component/bg.jpg"></Image>
            </VisualBrush.Visual>
        </VisualBrush>
    </Grid.Background>

    <RadioButton Content="Graph" Name="dsad" FontSize="15" ></RadioButton>

</Grid>

imageA:

enter image description here

imageB:

enter image description here

EDITED:

imageC:

enter image description here

like image 310
0070 Avatar asked Feb 18 '23 04:02

0070


1 Answers

Try it

 <ImageBrush x:Key="SimpleBitmap" ImageSource="Assets\BitmapImage.png" TileMode="FlipY"      Stretch="Uniform"AlignmentY="Top" Viewport="0,0,10,10" ViewportUnits="Absolute" />

Where BitmapImage Width = 10, and BitmapImage Height = 10

like image 172
jimpanzer Avatar answered Feb 28 '23 09:02

jimpanzer